summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order_line.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-10-03 10:12:24 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-10-03 10:12:24 +0700
commit4a69c71eab2d4ea3504a0cf6e3a9ca241be48594 (patch)
treeeb03e833a86acfe72870099d1671ad6dfae86d37 /indoteknik_custom/models/sale_order_line.py
parent8b63d79efe0137ce6af535847f33868e73ce8d3c (diff)
push
Diffstat (limited to 'indoteknik_custom/models/sale_order_line.py')
-rw-r--r--indoteknik_custom/models/sale_order_line.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index d1dcd0af..dca8534c 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -14,7 +14,12 @@ class SaleOrderLine(models.Model):
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]"
)
+ vendor_md_id = fields.Many2one(
+ 'res.partner', string='MD Vendor', readonly=True,
+ change_default=True, index=True, tracking=1
+ )
purchase_price = fields.Float('Purchase', required=True, digits='Product Price', default=0.0)
+ purchase_price_md = fields.Float('MD Purchase', required=True, digits='Product Price', default=0.0)
purchase_tax_id = fields.Many2one('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)])
delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line')
fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0)
@@ -245,9 +250,11 @@ class SaleOrderLine(models.Model):
# query, limit=1, order='count_trx_po desc, count_trx_po_vendor desc')
price, taxes, vendor_id = self._get_purchase_price(line.product_id)
line.vendor_id = vendor_id
+ line.vendor_md_id = vendor_id
line.tax_id = line.order_id.sales_tax_id
# price, taxes = line._get_valid_purchase_price(purchase_price)
line.purchase_price = price
+ line.purchase_price_md = price
line.purchase_tax_id = taxes
attribute_values = line.product_id.product_template_attribute_value_ids.mapped('name')