diff --git a/rma/models/rma_operation.py b/rma/models/rma_operation.py index 104dc9bf..a4a55a24 100644 --- a/rma/models/rma_operation.py +++ b/rma/models/rma_operation.py @@ -33,15 +33,14 @@ class RmaOperation(models.Model): return self.env.ref("rma.route_rma_supplier") name = fields.Char("Description", required=True) - code = fields.Char("Code", required=True) - active = fields.Boolean(string="Active", default=True) + code = fields.Char(required=True) + active = fields.Boolean(default=True) receipt_policy = fields.Selection( [ ("no", "Not required"), ("ordered", "Based on Ordered Quantities"), ("delivered", "Based on Delivered Quantities"), ], - string="Receipts Policy", default="no", ) delivery_policy = fields.Selection( @@ -50,7 +49,6 @@ class RmaOperation(models.Model): ("ordered", "Based on Ordered Quantities"), ("received", "Based on Received Quantities"), ], - string="Delivery Policy", default="no", ) in_route_id = fields.Many2one( diff --git a/rma/models/rma_order.py b/rma/models/rma_order.py index b88cea25..df89802c 100644 --- a/rma/models/rma_order.py +++ b/rma/models/rma_order.py @@ -77,7 +77,6 @@ class RmaOrder(models.Model): name = fields.Char(string="Group Number", index=True, copy=False) type = fields.Selection( [("customer", "Customer"), ("supplier", "Supplier")], - string="Type", required=True, default=lambda self: self._get_default_type(), readonly=True, @@ -145,7 +144,6 @@ class RmaOrder(models.Model): ("approved", "Approved"), ("done", "Done"), ], - string="State", default="draft", store=True, ) diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index f307575e..4ac27392 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -217,7 +217,7 @@ class RmaOrderLine(models.Model): help="Add here the supplier RMA #. Otherwise an internal code is" " assigned.", copy=False, ) - description = fields.Text(string="Description") + description = fields.Text() conditions = fields.Html(string="Terms and conditions") origin = fields.Char( string="Source Document", @@ -232,14 +232,12 @@ class RmaOrderLine(models.Model): ("approved", "Approved"), ("done", "Done"), ], - string="State", default="draft", tracking=True, ) operation_id = fields.Many2one( comodel_name="rma.operation", required=True, - string="Operation", readonly=False, tracking=True, ) @@ -258,7 +256,6 @@ class RmaOrderLine(models.Model): required=True, store=True, tracking=True, - string="Partner", readonly=True, states={"draft": [("readonly", False)]}, ) @@ -267,7 +264,6 @@ class RmaOrderLine(models.Model): ) product_id = fields.Many2one( comodel_name="product.product", - string="Product", ondelete="restrict", required=True, readonly=True, @@ -295,9 +291,7 @@ class RmaOrderLine(models.Model): readonly=True, states={"draft": [("readonly", False)]}, ) - price_unit = fields.Monetary( - string="Price Unit", readonly=True, states={"draft": [("readonly", False)]} - ) + price_unit = fields.Monetary(readonly=True, states={"draft": [("readonly", False)]}) in_shipment_count = fields.Integer( compute="_compute_in_shipment_count", string="# of Shipments" ) @@ -316,18 +310,15 @@ class RmaOrderLine(models.Model): ) currency_id = fields.Many2one( "res.currency", - string="Currency", default=lambda self: self.env.company.currency_id, ) company_id = fields.Many2one( comodel_name="res.company", - string="Company", required=True, default=lambda self: self.env.company, ) type = fields.Selection( selection=[("customer", "Customer"), ("supplier", "Supplier")], - string="Type", required=True, default=lambda self: self._get_default_type(), readonly=True, @@ -349,7 +340,6 @@ class RmaOrderLine(models.Model): ("delivered", "Based on Delivered Quantities"), ], required=True, - string="Receipts Policy", default="no", readonly=False, ) @@ -360,7 +350,6 @@ class RmaOrderLine(models.Model): ("received", "Based on Received Quantities"), ], required=True, - string="Delivery Policy", default="no", readonly=False, ondelete="cascade", @@ -427,7 +416,6 @@ class RmaOrderLine(models.Model): help="Address of the customer in case of Supplier RMA operation " "dropship.", ) qty_to_receive = fields.Float( - string="Qty To Receive", digits="Product Unit of Measure", compute="_compute_qty_to_receive", store=True, @@ -441,14 +429,12 @@ class RmaOrderLine(models.Model): store=True, ) qty_received = fields.Float( - string="Qty Received", copy=False, digits="Product Unit of Measure", compute="_compute_qty_received", store=True, ) qty_to_deliver = fields.Float( - string="Qty To Deliver", copy=False, digits="Product Unit of Measure", readonly=True, @@ -464,7 +450,6 @@ class RmaOrderLine(models.Model): store=True, ) qty_delivered = fields.Float( - string="Qty Delivered", copy=False, digits="Product Unit of Measure", readonly=True, diff --git a/rma/report/rma_report.xml b/rma/report/rma_report.xml index a9717720..c5b9a811 100644 --- a/rma/report/rma_report.xml +++ b/rma/report/rma_report.xml @@ -1,6 +1,6 @@ - + RMA rma.order.line @@ -21,5 +21,4 @@ report - diff --git a/rma/security/rma.xml b/rma/security/rma.xml index e525e177..4ee2080a 100644 --- a/rma/security/rma.xml +++ b/rma/security/rma.xml @@ -1,6 +1,5 @@ - - + RMA @@ -23,10 +22,10 @@ RMA Manager + /> @@ -48,48 +47,47 @@ + /> rma order multi-company + name="model_id" + search="[('model','=','rma.order')]" + model="ir.model" + /> ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + name="domain_force" + >['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] rma order line multi-company + name="model_id" + search="[('model','=','rma.order.line')]" + model="ir.model" + /> ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + name="domain_force" + >['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] rma operation multi-company + name="model_id" + search="[('model','=','rma.operation')]" + model="ir.model" + /> ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + name="domain_force" + >['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index e093c526..aa33ce31 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -6,7 +6,7 @@ from odoo.tests import common class TestRma(common.TransactionCase): - """ Test the routes and the quantities """ + """Test the routes and the quantities""" @classmethod def setUpClass(cls): @@ -135,7 +135,7 @@ class TestRma(common.TransactionCase): } ) wizard.with_context( - { + **{ "move_ids": [(4, move.id)], "reference_move_id": move.id, "customer": True, @@ -157,7 +157,7 @@ class TestRma(common.TransactionCase): } ) wizard.with_context( - { + **{ "move_ids": [(4, move.id)], "reference_move_id": move.id, "active_ids": rma_id.id, @@ -230,7 +230,7 @@ class TestRma(common.TransactionCase): def test_01_rma_order_line(self): for line in self.rma_customer_id.rma_line_ids: line.with_context( - {"default_rma_id": line.rma_id.id} + **{"default_rma_id": line.rma_id.id} )._default_warehouse_id() line._default_location_id() line._onchange_delivery_address() @@ -276,7 +276,7 @@ class TestRma(common.TransactionCase): def test_02_customer_rma(self): self.rma_customer_id.rma_line_ids.action_rma_to_approve() wizard = self.rma_make_picking.with_context( - { + **{ "active_ids": self.rma_customer_id.rma_line_ids.ids, "active_model": "rma.order.line", "picking_type": "incoming", @@ -397,7 +397,7 @@ class TestRma(common.TransactionCase): ) wizard = self.rma_make_picking.with_context( - { + **{ "active_id": 1, "active_ids": self.rma_customer_id.rma_line_ids.ids, "active_model": "rma.order.line", @@ -526,7 +526,7 @@ class TestRma(common.TransactionCase): line.action_rma_to_approve() line.action_rma_approve() wizard = self.rma_make_picking.with_context( - { + **{ "active_id": 1, "active_ids": self.rma_droship_id.rma_line_ids.ids, "active_model": "rma.order.line", @@ -555,7 +555,7 @@ class TestRma(common.TransactionCase): self.rma_droship_id.out_shipment_count, 0, "Incorrect Out Shipment Count" ) wizard = self.make_supplier_rma.with_context( - { + **{ "active_ids": self.rma_droship_id.rma_line_ids.ids, "active_model": "rma.order.line", "active_id": 1, @@ -626,7 +626,7 @@ class TestRma(common.TransactionCase): self.rma_supplier_id.rma_line_ids._onchange_operation_id() self.rma_supplier_id.rma_line_ids._onchange_delivery_address() wizard = self.rma_make_picking.with_context( - { + **{ "active_ids": self.rma_supplier_id.rma_line_ids.ids, "active_model": "rma.order.line", "picking_type": "outgoing", @@ -743,7 +743,7 @@ class TestRma(common.TransactionCase): "Wrong qty_received", ) wizard = self.rma_make_picking.with_context( - { + **{ "active_id": 1, "active_ids": self.rma_supplier_id.rma_line_ids.ids, "active_model": "rma.order.line", diff --git a/rma/views/rma_operation_view.xml b/rma/views/rma_operation_view.xml index e2e363e3..c2bb1b59 100644 --- a/rma/views/rma_operation_view.xml +++ b/rma/views/rma_operation_view.xml @@ -4,7 +4,7 @@ rma.operation.tree rma.operation - + diff --git a/rma/views/rma_order_line_view.xml b/rma/views/rma_order_line_view.xml index 647a0c33..402c4145 100644 --- a/rma/views/rma_order_line_view.xml +++ b/rma/views/rma_order_line_view.xml @@ -1,14 +1,10 @@ - rma.order.line.tree rma.order.line - + @@ -29,10 +25,7 @@ rma.order.line.supplier.tree rma.order.line - + @@ -55,71 +48,71 @@

+ name="name" + readonly="1" + invisible="context.get('hide_title',False)" + />

+ name="partner_id" + context="{'res_partner_search_mode': 'customer'}" + string="Customer" + /> + context="{'show_address': 1}" + options="{'always_reload': 1}" + groups='rma.group_rma_delivery_invoice_address' + /> @@ -180,10 +173,10 @@ + name="lot_id" + groups="stock.group_production_lot" + attrs="{'required': [('product_tracking', 'in', ('serial', 'lot'))]}" + /> @@ -194,19 +187,19 @@ + /> + name="operation_id" + domain="[('type','=','customer')]" + /> @@ -228,9 +221,9 @@ + name="supplier_rma" + attrs="{'invisible':['|', ('type', '!=', 'customer'), ('customer_to_supplier','=',False)]}" + > @@ -240,42 +233,42 @@ + name="location_id" + domain="[('usage', '=', 'internal')]" + /> + name="in_route_id" + groups="stock.group_adv_location" + /> + name="customer_to_supplier" + attrs="{'invisible':[('type', '!=', 'customer')]}" + /> + /> + name="out_route_id" + groups="stock.group_adv_location" + /> + name="supplier_to_customer" + attrs="{'invisible':[('type', '!=', 'supplier')]}" + /> + /> @@ -285,16 +278,16 @@ + name="rma_id" + groups="rma.group_rma_groups" + /> + name="company" + string="Company" + groups="base.group_multi_company" + > @@ -302,10 +295,10 @@
+ name="message_follower_ids" + widget="mail_followers" + groups="base.group_user" + />
@@ -319,24 +312,24 @@ primary + expr="//button[@name='action_view_rma_lines']/field" + position="attributes" + > Customer RMA Supplier {'res_partner_search_mode': 'supplier'} + name="context" + >{'res_partner_search_mode': 'supplier'} 1 [('picking_id.partner_id', '=', partner_id), + name="domain" + >[('picking_id.partner_id', '=', partner_id), ('location_id.usage', '=', 'supplier'), ('state', '=', 'done')] @@ -360,67 +353,67 @@ + name="assigned_to" + domain="[('assigned_to','=',uid)]" + help="My RMAs" + /> + name="to_receive" + domain="[('state','!=', 'done'),('qty_to_receive','>',0.0)]" + help="To Receive" + /> + name="to_deliver" + domain="[('state','!=', 'done'),('qty_to_deliver','>',0.0)]" + help="To Deliver" + /> + name="to_send_to_supplier" + domain="[('state','!=', 'done'),('qty_to_supplier_rma','>',0.0)]" + help="To Send to Supplier RMA" + /> + name="status" + string="State" + domain="[]" + context="{'group_by':'state'}" + /> + name="partner" + string="Partner" + domain="[]" + context="{'group_by':'partner_id'}" + /> + name="operation" + string="Operation" + domain="[]" + context="{'group_by':'operation_id'}" + /> + name="product" + string="Product" + domain="[]" + context="{'group_by':'product_id'}" + /> + name="to_receive" + string="To Receive" + domain="[('qty_to_receive', '>', 0)]" + context="{'group_by':'partner_id'}" + /> + name="to_deliver" + string="To Deliver" + domain="[('qty_to_deliver', '>', 0)]" + context="{'group_by':'partner_id'}" + /> @@ -440,8 +433,8 @@ rma.order.line [('type','=', 'supplier')] {"search_default_assigned_to":uid, "supplier":1} + name="context" + >{"search_default_assigned_to":uid, "supplier":1} tree,form
@@ -470,5 +463,4 @@ if records.filtered(lambda x: x.state == "draft"):
- diff --git a/rma/views/rma_order_view.xml b/rma/views/rma_order_view.xml index ac74f836..0fb61aa9 100644 --- a/rma/views/rma_order_view.xml +++ b/rma/views/rma_order_view.xml @@ -4,7 +4,7 @@ rma.order.tree rma.order - + @@ -17,7 +17,7 @@ rma.order.supplier.tree rma.order - + @@ -146,7 +146,7 @@ 'default_partner_id': partner_id, 'hide_title': True}" > - + @@ -297,7 +297,7 @@ 'supplier': 1, 'hide_title': True}" > - + diff --git a/rma/wizards/rma_make_picking_view.xml b/rma/wizards/rma_make_picking_view.xml index 6e1d094f..111a9ee2 100644 --- a/rma/wizards/rma_make_picking_view.xml +++ b/rma/wizards/rma_make_picking_view.xml @@ -7,7 +7,7 @@
- + - + diff --git a/rma/wizards/rma_order_line_make_supplier_rma_view.xml b/rma/wizards/rma_order_line_make_supplier_rma_view.xml index 99a83aa2..e145b34c 100644 --- a/rma/wizards/rma_order_line_make_supplier_rma_view.xml +++ b/rma/wizards/rma_order_line_make_supplier_rma_view.xml @@ -25,7 +25,7 @@ - +