diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-11-11 16:10:44 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-11-11 16:10:44 +0700 |
| commit | c8ce7890c7174ea678da282e3fa04501b24951bc (patch) | |
| tree | f007d7bed000bdfa38f64d85af122f1d65b5c565 /indoteknik_custom/models/sale_order_line.py | |
| parent | 4c2325d4a983ced3a25a9d53d7613a9186360b17 (diff) | |
| parent | 17d46cf9f4eede8177b2373c03d5b36123f712c1 (diff) | |
Merge branch 'production' into iman/request-renca-stock
Diffstat (limited to 'indoteknik_custom/models/sale_order_line.py')
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 964b3ff2..5a6640ec 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -252,12 +252,9 @@ class SaleOrderLine(models.Model): # purchase_price = self.env['purchase.pricelist'].search( # 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_md_id = vendor_id line.vendor_id = vendor_id - line.margin_md = line.item_percent_margin line.tax_id = line.order_id.sales_tax_id # price, taxes = line._get_valid_purchase_price(purchase_price) - line.purchase_price_md = price line.purchase_price = price line.purchase_tax_id = taxes @@ -271,6 +268,14 @@ class SaleOrderLine(models.Model): line.name = line_name line.weight = line.product_id.weight + @api.constrains('vendor_id') + def _check_vendor_id(self): + for line in self: + price, taxes, vendor_id = self._get_purchase_price(line.product_id) + line.vendor_md_id = vendor_id if vendor_id else None + line.margin_md = line.item_percent_margin + line.purchase_price_md = price + def compute_delivery_amt_line(self): for line in self: try: |
