From 27c207c805085ebab5c5bf56c176b8b244ae10d0 Mon Sep 17 00:00:00 2001 From: Stepan Savelyev Date: Wed, 29 Jan 2020 15:28:54 +0500 Subject: [PATCH] [ADD] fields, cost/amount logic --- data/fields_default.xml | 63 ++++++++++++++++++++------- wizard/res_partner_contract_wizard.py | 4 +- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/data/fields_default.xml b/data/fields_default.xml index a8d64f5..21c35fa 100644 --- a/data/fields_default.xml +++ b/data/fields_default.xml @@ -195,12 +195,17 @@ ctx = { "order_name": self.order_id.name, "order_date": "{} {} {}".format(order_date.day, months[order_date.month], order_date.year), - + + "design_cost": self.to_fixed(self.design_cost), + "design_period": self.design_period, + "design_doc_cost": self.to_fixed(self.design_doc_cost), + "design_doc_period": self.design_doc_period, "delivery_address": self.delivery_address, "delivery_period": self.delivery_period, "installation_address": self.installation_address, - "installation_cost": self.installation_cost, + "installation_cost": self.to_fixed(self.installation_cost), "installation_period": self.installation_period, + "total_cost": self.to_fixed(self.total_cost), "payment_part_one": self.payment_part_one, "payment_part_two": self.payment_part_two, @@ -337,46 +342,81 @@ action = ctx 4 + + Design Cost + design_cost + + False + + + + Design Period + design_period + + False + + + + Design Documentation Period + design_doc_period + + False + + + + Design Documentation Cost + design_doc_cost + + False + + Delivery Address delivery_address - 5 + False Delivery Period delivery_period - 6 + False Installation Address installation_address - 7 + False Installation Cost installation_cost - 8 + False Installation Period installation_period - 9 + False + + + + Total Cost + total_cost + + False Day dd Number - 8 + 11 @@ -442,13 +482,6 @@ action = ctx 37 - - Delivery Period - delivery_period - - 38 - - diff --git a/wizard/res_partner_contract_wizard.py b/wizard/res_partner_contract_wizard.py index e512bf3..27770cb 100644 --- a/wizard/res_partner_contract_wizard.py +++ b/wizard/res_partner_contract_wizard.py @@ -204,8 +204,8 @@ class ContractWizard(models.TransientModel, Extension): "description": item.product_id.description_sale, "count": item.product_uom_qty, "unit": item.product_uom.name, - "cost": item.price_unit, - "subtotal": item.price_subtotal, + "cost": self.to_fixed(item.price_unit), + "subtotal": self.to_fixed(item.price_subtotal), } for item in self.target.order_id.order_line or [] ], "total_amount": self.to_fixed(sum(self.target.order_id.order_line.mapped("price_subtotal")))