diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-03 11:55:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-03 11:55:16 +0700 |
| commit | 7059f095dd09649f7c12f74ff29200f644bbc854 (patch) | |
| tree | 9e7dc3c1e0ca800a1b589cb3c65dddf5ad798894 /indoteknik_custom/models/sale_order_line.py | |
| parent | 4a69c71eab2d4ea3504a0cf6e3a9ca241be48594 (diff) | |
push
Diffstat (limited to 'indoteknik_custom/models/sale_order_line.py')
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index dca8534c..06b0f53d 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -14,12 +14,9 @@ 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 - ) + vendor_md_id = fields.Many2one('res.partner', string='MD Vendor') 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_price_md = fields.Float('MD Purchase') 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) @@ -138,6 +135,7 @@ class SaleOrderLine(models.Model): elif self.product_id.categ_id.id == 34: # finish good / manufacturing only cost = self.product_id.standard_price self.purchase_price = cost + self.purchase_price_md = cost elif self.product_id.x_manufacture.override_vendor_id: # purchase_price = self.env['purchase.pricelist'].search( # [('vendor_id', '=', self.product_id.x_manufacture.override_vendor_id.id), @@ -145,6 +143,8 @@ class SaleOrderLine(models.Model): # limit=1, order='count_trx_po desc, count_trx_po_vendor desc') price, taxes, vendor_id = self._get_purchase_price_by_vendor(self.product_id, self.vendor_id) self.purchase_price = price + self.purchase_price_md = price + self.vendor_md_id = self.vendor_id self.purchase_tax_id = taxes # else: # purchase_price = self.env['purchase.pricelist'].search( |
