diff --git a/rma_sale/__manifest__.py b/rma_sale/__manifest__.py index 2dd6ff81..0bd2d521 100644 --- a/rma_sale/__manifest__.py +++ b/rma_sale/__manifest__.py @@ -3,7 +3,7 @@ { "name": "RMA Sale", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "LGPL-3", "category": "RMA", "summary": "Links RMA with Sales Orders", diff --git a/rma_sale/models/procurement.py b/rma_sale/models/procurement.py index bc9a29ee..6d7c9da9 100644 --- a/rma_sale/models/procurement.py +++ b/rma_sale/models/procurement.py @@ -18,7 +18,7 @@ class StockRule(models.Model): company_id, values, ): - res = super(StockRule, self)._get_stock_move_values( + res = super()._get_stock_move_values( product_id, product_qty, product_uom, diff --git a/rma_sale/models/rma_order.py b/rma_sale/models/rma_order.py index 8a580678..ec5e5cdc 100644 --- a/rma_sale/models/rma_order.py +++ b/rma_sale/models/rma_order.py @@ -27,7 +27,7 @@ class RmaOrder(models.Model): ("sale_line_id", "=", line.sale_line_id.id), ] else: - domain = super(RmaOrder, self)._get_line_domain(rma_id, line) + domain = super()._get_line_domain(rma_id, line) return domain def action_view_sale_order(self): diff --git a/rma_sale/models/rma_order_line.py b/rma_sale/models/rma_order_line.py index 4f722a08..a42cb8a8 100644 --- a/rma_sale/models/rma_order_line.py +++ b/rma_sale/models/rma_order_line.py @@ -42,8 +42,6 @@ class RmaOrderLine(models.Model): string="Originating Sales Order Line", ondelete="restrict", copy=False, - readonly=True, - states={"draft": [("readonly", False)]}, ) sale_id = fields.Many2one( string="Source Sales Order", related="sale_line_id.order_id" @@ -52,8 +50,6 @@ class RmaOrderLine(models.Model): comodel_name="sale.order.line", inverse_name="rma_line_id", string="Sales Order Lines", - readonly=True, - states={"draft": [("readonly", False)]}, copy=False, ) qty_to_sell = fields.Float( @@ -85,7 +81,7 @@ class RmaOrderLine(models.Model): @api.onchange("product_id", "partner_id") def _onchange_product_id(self): """Domain for sale_line_id is computed here to make it dynamic.""" - res = super(RmaOrderLine, self)._onchange_product_id() + res = super()._onchange_product_id() if not res.get("domain"): res["domain"] = {} domain = [ @@ -100,7 +96,7 @@ class RmaOrderLine(models.Model): @api.onchange("operation_id") def _onchange_operation_id(self): - res = super(RmaOrderLine, self)._onchange_operation_id() + res = super()._onchange_operation_id() if self.operation_id: self.sale_policy = self.operation_id.sale_policy or "no" return res @@ -173,7 +169,7 @@ class RmaOrderLine(models.Model): self._remove_other_data_origin("sale_line_id") def _remove_other_data_origin(self, exception): - res = super(RmaOrderLine, self)._remove_other_data_origin(exception) + res = super()._remove_other_data_origin(exception) if not exception == "sale_line_id": self.sale_line_id = False return res @@ -224,7 +220,7 @@ class RmaOrderLine(models.Model): def _get_price_unit(self): self.ensure_one() - price_unit = super(RmaOrderLine, self)._get_price_unit() + price_unit = super()._get_price_unit() if self.sale_line_id: moves = self.sale_line_id.move_ids.filtered( lambda x: x.state == "done" diff --git a/rma_sale/models/sale_order_line.py b/rma_sale/models/sale_order_line.py index 072741c0..60665dd9 100644 --- a/rma_sale/models/sale_order_line.py +++ b/rma_sale/models/sale_order_line.py @@ -16,16 +16,14 @@ class SaleOrderLine(models.Model): (self._rec_name, operator, name), ("order_id.name", operator, name), ] - return super(SaleOrderLine, self).name_search( - name=name, args=args, operator=operator, limit=limit - ) + return super().name_search(name=name, args=args, operator=operator, limit=limit) @api.model def _name_search( self, name="", args=None, operator="ilike", limit=100, name_get_uid=None ): """Typed text is cleared here for better extensibility.""" - return super(SaleOrderLine, self)._name_search( + return super()._name_search( name="", args=args, operator=operator, @@ -35,7 +33,7 @@ class SaleOrderLine(models.Model): def _get_sale_line_rma_name_get_label(self): self.ensure_one() - return "SO:%s | INV: %s, | PART:%s | QTY:%s" % ( + return "SO:{} | INV: {}, | PART:{} | QTY:{}".format( self.order_id.name, " ".join(str(x) for x in [inv.name for inv in self.order_id.invoice_ids]), self.product_id.name, @@ -61,8 +59,6 @@ class SaleOrderLine(models.Model): ) def _prepare_order_line_procurement(self, group_id=False): - vals = super(SaleOrderLine, self)._prepare_order_line_procurement( - group_id=group_id - ) + vals = super()._prepare_order_line_procurement(group_id=group_id) vals.update({"rma_line_id": self.rma_line_id.id}) return vals diff --git a/rma_sale/tests/test_rma_sale.py b/rma_sale/tests/test_rma_sale.py index 8de84e6d..bd12364b 100644 --- a/rma_sale/tests/test_rma_sale.py +++ b/rma_sale/tests/test_rma_sale.py @@ -7,7 +7,7 @@ from odoo.tests import common class TestRmaSale(common.SingleTransactionCase): @classmethod def setUpClass(cls): - super(TestRmaSale, cls).setUpClass() + super().setUpClass() cls.rma_obj = cls.env["rma.order"] cls.rma_line_obj = cls.env["rma.order.line"] @@ -62,7 +62,6 @@ class TestRmaSale(common.SingleTransactionCase): }, ), ], - "pricelist_id": cls.env.ref("product.list0").id, } ) diff --git a/rma_sale/tests/test_rma_stock_account_sale.py b/rma_sale/tests/test_rma_stock_account_sale.py index 8562719f..4868a4f3 100644 --- a/rma_sale/tests/test_rma_stock_account_sale.py +++ b/rma_sale/tests/test_rma_stock_account_sale.py @@ -10,7 +10,7 @@ from odoo.addons.rma_account.tests.test_rma_stock_account import TestRmaStockAcc class TestRmaStockAccountSale(TestRmaStockAccount): @classmethod def setUpClass(cls): - super(TestRmaStockAccountSale, cls).setUpClass() + super().setUpClass() cls.operation_receive_refund = cls.env.ref( "rma_account.rma_operation_customer_refund" ) @@ -35,12 +35,12 @@ class TestRmaStockAccountSale(TestRmaStockAccount): }, ), ], - "pricelist_id": cls.env.ref("product.list0").id, } ) cls.so1.action_confirm() for ml in cls.so1.picking_ids.move_line_ids: - ml.qty_done = ml.reserved_uom_qty + ml.quantity = ml.quantity_product_uom + ml.picked = True cls.so1.picking_ids.button_validate() def test_01_cost_from_so_move(self): diff --git a/rma_sale/views/rma_order_line_view.xml b/rma_sale/views/rma_order_line_view.xml index 03c5c239..0f77b6f3 100644 --- a/rma_sale/views/rma_order_line_view.xml +++ b/rma_sale/views/rma_order_line_view.xml @@ -12,7 +12,7 @@ name="action_view_origin_sale_order" class="oe_stat_button" icon="fa-strikethrough" - attrs="{'invisible': [('sale_id', '=', False)]}" + invisible="sale_id == False" string="Origin Sale Order" > @@ -21,7 +21,7 @@ name="action_view_sale_order" class="oe_stat_button" icon="fa-strikethrough" - attrs="{'invisible': [('sales_count', '=', 0)]}" + invisible="sales_count == 0" groups="sales_team.group_sale_salesman_all_leads" > - + @@ -53,9 +54,13 @@ - + @@ -71,13 +76,13 @@ name="%(action_rma_order_line_make_sale_order)d" string="Create Sales Quotation" class="oe_highlight" - attrs="{'invisible':['|', '|', '|', ('qty_to_sell', '=', 0), ('qty_to_sell', '<', 0), ('state', '!=', 'approved'), ('sale_policy', '=', 'no')]}" + invisible="qty_to_sell == 0 or qty_to_sell < 0 or state != 'approved' or sale_policy == 'no'" type="action" /> diff --git a/rma_sale/views/rma_order_view.xml b/rma_sale/views/rma_order_view.xml index 4d8618d0..e8a1767e 100644 --- a/rma_sale/views/rma_order_view.xml +++ b/rma_sale/views/rma_order_view.xml @@ -12,7 +12,7 @@ class="oe_stat_button" icon="fa-pencil-square-o" groups="sales_team.group_sale_salesman" - attrs="{'invisible':[('type', '!=', 'customer')]}" + invisible="type != 'customer'" > diff --git a/rma_sale/views/sale_order_view.xml b/rma_sale/views/sale_order_view.xml index ba2d9148..0951eabe 100644 --- a/rma_sale/views/sale_order_view.xml +++ b/rma_sale/views/sale_order_view.xml @@ -35,7 +35,7 @@ name="action_view_rma" class="oe_stat_button" icon="fa-dropbox" - attrs="{'invisible': [('rma_count', '=', 0)]}" + invisible="rma_count == 0" groups="rma.group_rma_customer_user" > diff --git a/rma_sale/wizards/rma_add_sale.py b/rma_sale/wizards/rma_add_sale.py index 1adcd1f5..aa0b19c3 100644 --- a/rma_sale/wizards/rma_add_sale.py +++ b/rma_sale/wizards/rma_add_sale.py @@ -11,7 +11,7 @@ class RmaAddSale(models.TransientModel): @api.model def default_get(self, fields_list): - res = super(RmaAddSale, self).default_get(fields_list) + res = super().default_get(fields_list) rma_obj = self.env["rma.order"] rma_id = self.env.context["active_ids"] or [] active_model = self.env.context["active_model"] @@ -197,8 +197,8 @@ class RmaAddSale(models.TransientModel): rec = rma_line_obj.create(data) # Ensure that configuration on the operation is applied # TODO MIG: in v16 the usage of such onchange can be removed in - # favor of (pre)computed stored editable fields for all policies - # and configuration in the RMA operation. + # favor of (pre)computed stored editable fields for all + # policies and configuration in the RMA operation. rec._onchange_operation_id() rec.price_unit = rec._get_price_unit() rma = self.rma_id diff --git a/rma_sale/wizards/rma_add_sale.xml b/rma_sale/wizards/rma_add_sale.xml index 0e823ec0..9743b248 100644 --- a/rma_sale/wizards/rma_add_sale.xml +++ b/rma_sale/wizards/rma_add_sale.xml @@ -44,23 +44,20 @@ - + The creation of the RMA Lines will be separated according to the lots or serials selected