From 21e589345d3f278c75e74afa9ad8d3766d2620d0 Mon Sep 17 00:00:00 2001 From: joel <joemaglioni1@gmail.com> Date: Fri, 3 Nov 2023 12:13:33 -0300 Subject: [PATCH] [T1871] fix partner addres domain and translates. --- i18n/es_AR.po | 16 ++++++++-------- models/crm_claim.py | 9 +++++---- models/sale_order.py | 32 ++++++++++++++++++++++++-------- views/crm_claim_views.xml | 4 ++-- wizard/drilling_wizard.py | 7 ++++--- 5 files changed, 43 insertions(+), 25 deletions(-) diff --git a/i18n/es_AR.po b/i18n/es_AR.po index 8b13b2e..becbf40 100644 --- a/i18n/es_AR.po +++ b/i18n/es_AR.po @@ -143,9 +143,14 @@ msgid "Drilling completion Date" msgstr "Fecha Agujereado Finalizada" #. module: sale_custom -#: model:ir.model.fields,field_description:sale_custom.field_claim_order_line__final_amount -msgid "Final Amount" -msgstr "Monto final" +#: model:ir.model.fields,field_description:sale_custom.field_claim_order_line__initial_quantity +msgid "Initial Quantity" +msgstr "Cantidad inicial" + +#. module: sale_custom +#: model:ir.model.fields,field_description:sale_custom.field_claim_order_line__final_quantity +msgid "Final Quantity" +msgstr "Cantidad final" #. module: sale_custom #: model:ir.model.fields,field_description:sale_custom.field_drilling_wizard__hole_spacing @@ -170,11 +175,6 @@ msgstr "" msgid "Identifier" msgstr "" -#. module: sale_custom -#: model:ir.model.fields,field_description:sale_custom.field_claim_order_line__initial_amount -msgid "Initial Amount" -msgstr "Monto inicial" - #. module: sale_custom #: model:ir.model.fields,field_description:sale_custom.field_sale_order__partner_invoice_id msgid "Invoice Address" diff --git a/models/crm_claim.py b/models/crm_claim.py index a7c231f..037184a 100644 --- a/models/crm_claim.py +++ b/models/crm_claim.py @@ -108,13 +108,14 @@ class ClaimOrderLine(models.Model): replacement_product_id = fields.Many2one( string="Replacement Product", comodel_name="product.product", + required=False ) - initial_amount = fields.Integer( - string='Initial Amount', + initial_quantity = fields.Integer( + string='Initial Quantity', readonly=True, ) - final_amount = fields.Integer( - string='Final Amount' + final_quantity = fields.Integer( + string='Final Quantity' ) diff --git a/models/sale_order.py b/models/sale_order.py index a4d86e0..654216d 100644 --- a/models/sale_order.py +++ b/models/sale_order.py @@ -22,14 +22,6 @@ class SaleOrder(models.Model): readonly=True ) - partner_invoice_id = fields.Many2one( - domain="[('id', '=', partner_id)]", - ) - - partner_shipping_id = fields.Many2one( - domain="[('id', '=', partner_id)]", - ) - budget_owner_id = fields.Many2one( comodel_name='res.users', readonly=True, @@ -72,6 +64,30 @@ class SaleOrder(models.Model): compute='_compute_percentage', readonly=True ) + picking_policy = fields.Selection( + selection=[ + ('strict', 'the date must be respected'), + ('moderately ', 'Moderately strict'), + ('flexible', 'Admits delays')], + string='Shipping Policy', + required=True, + readonly=True, + default='flexible', + ) + + @api.onchange('partner_id') + def onchange_addres_partner_id(self): + domain = [] + if self.partner_id: + delivery_addres = self.partner_id.child_ids.filtered(lambda x: x.type == 'delivery').ids or [] + invoice_addres = self.partner_id.child_ids.filtered(lambda x: x.type == 'invoice').ids or [] + domain = { + "partner_invoice_id": [("id", "in", invoice_addres)], + "partner_shipping_id": [("id", "in", delivery_addres)] + } + return {"domain": domain} + + @api.depends('order_line') def _compute_percentage(self): diff --git a/views/crm_claim_views.xml b/views/crm_claim_views.xml index 3058469..1ad9b3b 100644 --- a/views/crm_claim_views.xml +++ b/views/crm_claim_views.xml @@ -26,8 +26,8 @@ <field name="claim_line" attrs='{"invisible": [("type_action", "!=", "correction")]}'> <tree string="Lines" editable="bottom" create="0" delete="1"> <field name="product_id"/> - <field name="initial_amount"/> - <field name="final_amount"/> + <field name="initial_quantity"/> + <field name="final_quantity"/> <field name="replacement_product_id" required="True"/> </tree> </field> diff --git a/wizard/drilling_wizard.py b/wizard/drilling_wizard.py index a840f64..d89695b 100644 --- a/wizard/drilling_wizard.py +++ b/wizard/drilling_wizard.py @@ -18,14 +18,15 @@ class DrillingWizard(models.TransientModel): drilling_type = fields.Selection( [('single', 'Single'), ('double', 'Double'), ('cangilones', 'Cangilones')], 'Type of drilling', + required=True ) hole_numbers = fields.Integer( string='Number of holes', - required=False + required=True ) hole_spacing = fields.Float( string='Hole Spacing', - required=False + required=True ) passage_holes = fields.Float( string='Passage between holes', @@ -41,7 +42,7 @@ class DrillingWizard(models.TransientModel): ) hole_diameter = fields.Float( string='Hole diameter', - required=False + required=True ) hole_unit_measure = fields.Selection( [('cm','cm'),('mm','mm'),('m','m')], -- GitLab