diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-22 15:06:14 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-22 15:06:14 +0700 |
| commit | 3939395d033d8d10f279bc7dd501bc7fbf1a035e (patch) | |
| tree | 9fe993787d071d08817a254bfddcb441d31cc66e | |
| parent | 5ed6910d689197416d0c87d269dd8362c079b831 (diff) | |
add column to purchase pricelist
| -rwxr-xr-x | indoteknik_custom/models/purchase_pricelist.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/indoteknik_custom/models/purchase_pricelist.py b/indoteknik_custom/models/purchase_pricelist.py index 86bb2f54..b85df109 100755 --- a/indoteknik_custom/models/purchase_pricelist.py +++ b/indoteknik_custom/models/purchase_pricelist.py @@ -11,12 +11,14 @@ class PurchasePricelist(models.Model): product_id = fields.Many2one('product.product', string="Product", required=True) vendor_id = fields.Many2one('res.partner', string="Vendor", required=True) product_price = fields.Float(string='Human Price', required=True) - system_price = fields.Float(string='System Price', required=True) + system_price = fields.Float(string='System Price', readonly=True) human_last_update = fields.Datetime(string='Human Update') system_last_update = fields.Datetime(string='System Update') count_trx_po = fields.Integer(string='Count Trx Product') count_trx_po_vendor = fields.Integer(string='Count Trx Vendor') - + taxes_product_id = fields.Many2one('account.tax', string='Taxes Human') + taxes_system_id = fields.Many2one('account.tax', string='Taxes System', readonly=True) + include_price = fields.Float(string='Include Price', readonly=True) @api.depends('product_id', 'vendor_id') def _compute_name(self): self.name = self.vendor_id.name + ', ' + self.product_id.name @@ -30,6 +32,21 @@ class PurchasePricelist(models.Model): else: self.human_last_update = current_time + # @api.constrains('system_last_update','system_price') + # def _contrains_include_price(self): + # taxes = self.taxes_system_id or self.taxes_product_id + # tax_include = taxes.price_include + # price_unit = self.system_price or self.product_price + # if taxes: + # if tax_include: + # price_unit = price_unit + # else: + # price_unit = price_unit + (price_unit * 11 / 100) + # else: + # price_unit = price_unit + (price_unit * 11 / 100) + + # self.include_price = price_unit + @api.constrains('vendor_id', 'product_id') def _check_duplicate_purchase_pricelist(self): for price in self: |
