summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-05-23 14:18:36 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-05-23 14:18:36 +0700
commit542318af94cfa755a35589f8299d6551597928db (patch)
treed2bec59d15127eebeba4ea6e7deb51f69109a9ae
parentabc587069b2526756b4848b53f1d20a8b5825134 (diff)
parent936c6cf2c1aea0e2b470d20d6fd41a10380bcac0 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into fix_tempo_lognote
-rw-r--r--indoteknik_custom/models/sale_order_line.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index 049bee2d..3c4965e5 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -255,33 +255,34 @@ class SaleOrderLine(models.Model):
def _get_valid_purchase_price(self, purchase_price):
current_time = datetime.now()
delta_time = current_time - timedelta(days=365)
+ default_timestamp = datetime(1970, 1, 1, 0, 0, 0)
# delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S')
price = 0
- taxes = ''
+ taxes = 24
vendor_id = ''
human_last_update = purchase_price.human_last_update or datetime.min
system_last_update = purchase_price.system_last_update or datetime.min
-
- if purchase_price.taxes_product_id.type_tax_use == 'purchase':
- price = purchase_price.product_price
- taxes = purchase_price.taxes_product_id.id
+
+ # if purchase_price.taxes_product_id.type_tax_use == 'purchase':
+ price = purchase_price.product_price
+ taxes = purchase_price.taxes_product_id.id or 24
+ vendor_id = purchase_price.vendor_id.id
+ if delta_time > human_last_update:
+ price = 0
+ taxes = 24
+ vendor_id = ''
+
+ if system_last_update > human_last_update:
+ # if purchase_price.taxes_system_id.type_tax_use == 'purchase':
+ price = purchase_price.system_price
+ taxes = purchase_price.taxes_system_id.id or 24
vendor_id = purchase_price.vendor_id.id
- if delta_time > human_last_update:
+ if delta_time > system_last_update:
price = 0
- taxes = ''
+ taxes = 24
vendor_id = ''
- if system_last_update > human_last_update:
- if purchase_price.taxes_system_id.type_tax_use == 'purchase':
- price = purchase_price.system_price
- taxes = purchase_price.taxes_system_id.id
- vendor_id = purchase_price.vendor_id.id
- if delta_time > system_last_update:
- price = 0
- taxes = ''
- vendor_id = ''
-
return price, taxes, vendor_id
@api.onchange('product_id')