From 248fd7cb0c93e60bdfccaf095cdb601a3319b65e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Sat, 24 Sep 2022 11:11:49 +0700 Subject: add several column in sales order and order line --- indoteknik_custom/models/sale_order.py | 20 ++++++++++++++++++-- indoteknik_custom/views/sale_order.xml | 6 ++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 7366d67a..30ac2058 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -21,6 +21,9 @@ class SaleOrder(models.Model): have_visit_service = fields.Boolean(string='Have Visit Service', help='To compute is customer get visit service', compute='_compute_have_visit_service') count_line_product = fields.Float('Count Line Product', compute='compute_count_line_product') delivery_amount = fields.Float('Delivery Amount', compute='compute_delivery_amount') + shipping_cost_covered = fields.Boolean('Shipping Cost Covered', help='Centang jika Shipping Cost ditanggung oleh ' + 'Indoteknik, jika dicentang akan ' + 'mempengaruhi margin') def _compute_have_visit_service(self): @@ -118,11 +121,24 @@ class SaleOrder(models.Model): class SaleOrderLine(models.Model): _inherit = 'sale.order.line' item_margin = fields.Float( - 'Total Margin', compute='compute_item_margin', + 'Margin', compute='compute_item_margin', help="Total Margin in Sales Order Header") item_percent_margin = fields.Float( - 'Total Percent Margin', compute='compute_item_margin', + '%Margin', compute='compute_item_margin', help="Total % Margin in Sales Order Header") + vendor = fields.Many2one( + 'res.partner', string='Vendor', readonly=True, + states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, + required=True, change_default=True, index=True, tracking=1, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",) + vendor = fields.Many2one( + '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)]", ) + purchase_price = fields.Float('Purchase', required=True, digits='Product Price', default=0.0) + tax_id = fields.Many2one('account.tax', string='Tax', + domain=['|', ('active', '=', False), ('active', '=', True)]) 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 b2466b0d..c101fe1b 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -13,9 +13,15 @@ /> + + + + + + -- cgit v1.2.3