diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-28 13:08:31 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-28 13:08:31 +0700 |
| commit | c86d91e089c4a72ee137365c4033f02c23238c09 (patch) | |
| tree | c178eca4e490f8fe92b05c0c468c17343582b4cd | |
| parent | 0c7c0ad2e8dca7a1e47cd5a13642543f01a74afd (diff) | |
| parent | ff7390468fb11915b35c9f522379132dde19a54d (diff) | |
Merge branch 'release' into nathan-dev
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 21 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index bf415dbb..b1f74587 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -342,7 +342,7 @@ class SaleOrder(models.Model): # must add product can sell validation if not line.product_id.product_tmpl_id.sale_ok: raise UserError('Product %s belum bisa dijual, harap hubungi finance' % line.product_id.display_name) - if line.product_id.id == 232383: + if line.product_id.id == 224484: raise UserError(_('Tidak bisa Confirm menggunakan Produk Sementara')) if not line.vendor_id or not line.purchase_price: raise UserError(_('Isi Vendor dan Harga Beli sebelum Request Approval')) @@ -575,7 +575,7 @@ class SaleOrderLine(models.Model): 'res.partner', string='Vendor', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, change_default=True, index=True, tracking=1, - domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", ) + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",) purchase_price = fields.Float('Purchase', required=True, digits='Product Price', default=0.0) purchase_tax_id = fields.Many2one('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) @@ -583,6 +583,23 @@ class SaleOrderLine(models.Model): fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0) line_no = fields.Integer('No', default=0, copy=False) note_procurement = fields.Char(string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") + vendor_subtotal = fields.Float(string='Vendor Subtotal', compute="_compute_vendor_subtotal") + + def _compute_vendor_subtotal(self): + for line in self: + if line.purchase_price > 0 and line.product_uom_qty > 0: + # product = line.product_id + + # if product: + # vendor_price = line.purchase_price + # if line.purchase_tax_id.price_include: + # vendor_price = line.purchase_price + # else: + # vendor_price = line.purchase_price + (line.purchase_price*11/100) + subtotal = line.purchase_price * line.product_uom_qty + line.vendor_subtotal = subtotal + else: + line.vendor_subtotal = 0 def compute_item_margin(self): for line in self: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 88fe5d7e..70e3392f 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -69,6 +69,7 @@ <field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]"/> <field name="item_percent_margin"/> <field name="note_procurement" optional="hide"/> + <field name="vendor_subtotal" optional="hide"/> </xpath> <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before"> <field name="line_no" readonly="1" optional="hide"/> |
