[MIG] rma: Migration to v17

This commit is contained in:
Carlos Vallés Fuster
2024-05-06 17:08:18 +02:00
committed by AaronHForgeFlow
parent e23335cee5
commit cb5a8a1ddd
19 changed files with 193 additions and 217 deletions

View File

@@ -7,7 +7,7 @@ RMA (Return Merchandise Authorization)
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:51ec7a60674dede1504836e5881ee8a0f776b770dcc8238dce37e8376e5c4301 !! source digest: sha256:310ce4e3f5919e5be643c54f11481d09bb8fc79cab65f08ac969ef3bf9d799fe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

View File

@@ -3,7 +3,7 @@
{ {
"name": "RMA (Return Merchandise Authorization)", "name": "RMA (Return Merchandise Authorization)",
"version": "16.0.1.0.0", "version": "17.0.1.0.0",
"license": "LGPL-3", "license": "LGPL-3",
"category": "RMA", "category": "RMA",
"summary": "Introduces the return merchandise authorization (RMA) process in odoo", "summary": "Introduces the return merchandise authorization (RMA) process in odoo",

View File

@@ -235,8 +235,6 @@ class RmaOrderLine(models.Model):
delivery_address_id = fields.Many2one( delivery_address_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
string="Partner delivery address", string="Partner delivery address",
readonly=True,
states={"draft": [("readonly", False)]},
help="This address will be used to deliver repaired or replacement " help="This address will be used to deliver repaired or replacement "
"products.", "products.",
) )
@@ -250,8 +248,6 @@ class RmaOrderLine(models.Model):
string="Reference", string="Reference",
required=True, required=True,
default="/", default="/",
readonly=True,
states={"draft": [("readonly", False)]},
help="Add here the supplier RMA #. Otherwise an internal code is" " assigned.", help="Add here the supplier RMA #. Otherwise an internal code is" " assigned.",
copy=False, copy=False,
) )
@@ -259,8 +255,6 @@ class RmaOrderLine(models.Model):
conditions = fields.Html(string="Terms and conditions") conditions = fields.Html(string="Terms and conditions")
origin = fields.Char( origin = fields.Char(
string="Source Document", string="Source Document",
readonly=True,
states={"draft": [("readonly", False)]},
help="Reference of the document that produced this rma.", help="Reference of the document that produced this rma.",
) )
date_rma = fields.Datetime( date_rma = fields.Datetime(
@@ -298,8 +292,6 @@ class RmaOrderLine(models.Model):
required=True, required=True,
store=True, store=True,
tracking=True, tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
) )
sequence = fields.Integer( sequence = fields.Integer(
default=10, help="Gives the sequence of this line when displaying the rma." default=10, help="Gives the sequence of this line when displaying the rma."
@@ -308,38 +300,28 @@ class RmaOrderLine(models.Model):
comodel_name="product.product", comodel_name="product.product",
ondelete="restrict", ondelete="restrict",
required=True, required=True,
readonly=True,
states={"draft": [("readonly", False)]},
) )
product_tracking = fields.Selection(related="product_id.tracking") product_tracking = fields.Selection(related="product_id.tracking")
lot_id = fields.Many2one( lot_id = fields.Many2one(
comodel_name="stock.lot", comodel_name="stock.lot",
string="Lot/Serial Number", string="Lot/Serial Number",
readonly=True,
states={"draft": [("readonly", False)]},
) )
product_qty = fields.Float( product_qty = fields.Float(
string="Return Qty", string="Return Qty",
copy=False, copy=False,
default=1.0, default=1.0,
digits="Product Unit of Measure", digits="Product Unit of Measure",
readonly=True,
states={"draft": [("readonly", False)]},
) )
uom_id = fields.Many2one( uom_id = fields.Many2one(
comodel_name="uom.uom", comodel_name="uom.uom",
string="Unit of Measure", string="Unit of Measure",
required=True, required=True,
readonly=True,
compute="_compute_uom_id", compute="_compute_uom_id",
precompute=True, precompute=True,
store=True, store=True,
states={"draft": [("readonly", False)]},
) )
price_unit = fields.Monetary( price_unit = fields.Monetary(
string="Unit cost", string="Unit cost",
readonly=True,
states={"draft": [("readonly", False)]},
help="Unit cost of the items under RMA", help="Unit cost of the items under RMA",
) )
in_shipment_count = fields.Integer( in_shipment_count = fields.Integer(
@@ -355,8 +337,6 @@ class RmaOrderLine(models.Model):
comodel_name="stock.move", comodel_name="stock.move",
string="Originating Stock Move", string="Originating Stock Move",
copy=False, copy=False,
readonly=True,
states={"draft": [("readonly", False)]},
) )
currency_id = fields.Many2one( currency_id = fields.Many2one(
"res.currency", "res.currency",
@@ -375,13 +355,9 @@ class RmaOrderLine(models.Model):
) )
customer_to_supplier = fields.Boolean( customer_to_supplier = fields.Boolean(
"The customer will send to the supplier", "The customer will send to the supplier",
readonly=True,
states={"draft": [("readonly", False)]},
) )
supplier_to_customer = fields.Boolean( supplier_to_customer = fields.Boolean(
"The supplier will send to the customer", "The supplier will send to the customer",
readonly=True,
states={"draft": [("readonly", False)]},
) )
receipt_policy = fields.Selection( receipt_policy = fields.Selection(
[ [
@@ -409,45 +385,35 @@ class RmaOrderLine(models.Model):
string="Inbound Route", string="Inbound Route",
required=True, required=True,
domain=[("rma_selectable", "=", True)], domain=[("rma_selectable", "=", True)],
readonly=True,
compute="_compute_in_route_id", compute="_compute_in_route_id",
precompute=True, precompute=True,
store=True, store=True,
states={"draft": [("readonly", False)]},
) )
out_route_id = fields.Many2one( out_route_id = fields.Many2one(
"stock.route", "stock.route",
string="Outbound Route", string="Outbound Route",
required=True, required=True,
domain=[("rma_selectable", "=", True)], domain=[("rma_selectable", "=", True)],
readonly=True,
compute="_compute_out_route_id", compute="_compute_out_route_id",
precompute=True, precompute=True,
store=True, store=True,
states={"draft": [("readonly", False)]},
) )
in_warehouse_id = fields.Many2one( in_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse", comodel_name="stock.warehouse",
string="Inbound Warehouse", string="Inbound Warehouse",
required=True, required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_warehouse_id(), default=lambda self: self._default_warehouse_id(),
) )
out_warehouse_id = fields.Many2one( out_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse", comodel_name="stock.warehouse",
string="Outbound Warehouse", string="Outbound Warehouse",
required=True, required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_warehouse_id(), default=lambda self: self._default_warehouse_id(),
) )
location_id = fields.Many2one( location_id = fields.Many2one(
comodel_name="stock.location", comodel_name="stock.location",
string="Send To This Company Location", string="Send To This Company Location",
required=True, required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_location_id(), default=lambda self: self._default_location_id(),
) )
customer_rma_id = fields.Many2one( customer_rma_id = fields.Many2one(
@@ -459,15 +425,11 @@ class RmaOrderLine(models.Model):
) )
supplier_address_id = fields.Many2one( supplier_address_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
readonly=True,
states={"draft": [("readonly", False)]},
string="Supplier Address", string="Supplier Address",
help="Address of the supplier in case of Customer RMA operation " "dropship.", help="Address of the supplier in case of Customer RMA operation " "dropship.",
) )
customer_address_id = fields.Many2one( customer_address_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
readonly=True,
states={"draft": [("readonly", False)]},
string="Customer Address", string="Customer Address",
help="Address of the customer in case of Supplier RMA operation " "dropship.", help="Address of the customer in case of Supplier RMA operation " "dropship.",
) )
@@ -526,9 +488,7 @@ class RmaOrderLine(models.Model):
compute="_compute_qty_supplier_rma", compute="_compute_qty_supplier_rma",
store=True, store=True,
) )
under_warranty = fields.Boolean( under_warranty = fields.Boolean(string="Under Warranty?")
string="Under Warranty?", readonly=True, states={"draft": [("readonly", False)]}
)
def _prepare_rma_line_from_stock_move(self, sm, lot=False): def _prepare_rma_line_from_stock_move(self, sm, lot=False):
if not self.type: if not self.type:

View File

@@ -77,8 +77,8 @@ class StockMove(models.Model):
def _update_reserved_quantity( def _update_reserved_quantity(
self, self,
need, need,
available_quantity,
location_id, location_id,
quant_ids=None,
lot_id=None, lot_id=None,
package_id=None, package_id=None,
owner_id=None, owner_id=None,
@@ -93,8 +93,8 @@ class StockMove(models.Model):
lot_id = self.rma_line_id.lot_id lot_id = self.rma_line_id.lot_id
return super()._update_reserved_quantity( return super()._update_reserved_quantity(
need, need,
available_quantity,
location_id, location_id,
quant_ids=quant_ids,
lot_id=lot_id, lot_id=lot_id,
package_id=package_id, package_id=package_id,
owner_id=owner_id, owner_id=owner_id,

View File

@@ -91,7 +91,7 @@ class StockWarehouse(models.Model):
self.mapped("rma_customer_out_pull_id").unlink() self.mapped("rma_customer_out_pull_id").unlink()
self.mapped("rma_supplier_in_pull_id").unlink() self.mapped("rma_supplier_in_pull_id").unlink()
self.mapped("rma_supplier_out_pull_id").unlink() self.mapped("rma_supplier_out_pull_id").unlink()
return super(StockWarehouse, self).write(vals) return super().write(vals)
def _create_rma_picking_types(self): def _create_rma_picking_types(self):
picking_type_obj = self.env["stock.picking.type"] picking_type_obj = self.env["stock.picking.type"]

View File

@@ -34,7 +34,7 @@
id="stock_report_delivery_has_serial_move_line" id="stock_report_delivery_has_serial_move_line"
inherit_id="stock.stock_report_delivery_has_serial_move_line" inherit_id="stock.stock_report_delivery_has_serial_move_line"
> >
<xpath expr="//td[@name='move_line_lot_qty_done']" position="before"> <xpath expr="//td[@name='move_line_lot_quantity']" position="before">
<td t-if="sml_has_rma"> <td t-if="sml_has_rma">
<span t-field="move_line.move_id.rma_line_id" /> <span t-field="move_line.move_id.rma_line_id" />
</td> </td>
@@ -45,7 +45,7 @@
id="stock_report_delivery_aggregated_move_lines" id="stock_report_delivery_aggregated_move_lines"
inherit_id="stock.stock_report_delivery_aggregated_move_lines" inherit_id="stock.stock_report_delivery_aggregated_move_lines"
> >
<xpath expr="//td[@name='move_line_aggregated_qty_done']" position="before"> <xpath expr="//td[@name='move_line_aggregated_quantity']" position="before">
<td t-if="sml_has_rma"> <td t-if="sml_has_rma">
<!-- TODO: To be implemented. <!-- TODO: To be implemented.
It will require de extension _get_aggregated_product_quantities It will require de extension _get_aggregated_product_quantities

View File

@@ -366,7 +366,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:51ec7a60674dede1504836e5881ee8a0f776b770dcc8238dce37e8376e5c4301 !! source digest: sha256:310ce4e3f5919e5be643c54f11481d09bb8fc79cab65f08ac969ef3bf9d799fe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/ForgeFlow/stock-rma/tree/17.0/rma"><img alt="ForgeFlow/stock-rma" src="https://img.shields.io/badge/github-ForgeFlow%2Fstock--rma-lightgray.png?logo=github" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/ForgeFlow/stock-rma/tree/17.0/rma"><img alt="ForgeFlow/stock-rma" src="https://img.shields.io/badge/github-ForgeFlow%2Fstock--rma-lightgray.png?logo=github" /></a></p>
<p>A Return Merchandise Authorization (RMA), is a part of the process of <p>A Return Merchandise Authorization (RMA), is a part of the process of

View File

@@ -10,7 +10,7 @@ class TestRma(common.TransactionCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(TestRma, cls).setUpClass() super().setUpClass()
# models # models
cls.rma_make_picking = cls.env["rma_make_picking.wizard"] cls.rma_make_picking = cls.env["rma_make_picking.wizard"]
cls.make_supplier_rma = cls.env["rma.order.line.make.supplier.rma"] cls.make_supplier_rma = cls.env["rma.order.line.make.supplier.rma"]
@@ -109,7 +109,8 @@ class TestRma(common.TransactionCase):
picking = cls.env["stock.picking"].browse(res["res_id"]) picking = cls.env["stock.picking"].browse(res["res_id"])
picking.action_assign() picking.action_assign()
for mv in picking.move_ids: for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done() picking._action_done()
return picking return picking
@@ -128,7 +129,8 @@ class TestRma(common.TransactionCase):
picking = cls.env["stock.picking"].browse(res["res_id"]) picking = cls.env["stock.picking"].browse(res["res_id"])
picking.action_assign() picking.action_assign()
for mv in picking.move_ids: for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done() picking._action_done()
return picking return picking
@@ -168,9 +170,8 @@ class TestRma(common.TransactionCase):
picking.action_confirm() picking.action_confirm()
picking.action_assign() picking.action_assign()
for ml in picking.move_ids: for ml in picking.move_ids:
ml.filtered( ml.filtered(lambda m: m.state != "waiting").quantity = ml.product_uom_qty
lambda m: m.state != "waiting" ml.filtered(lambda m: m.state != "waiting").picked = True
).quantity_done = ml.product_uom_qty
picking.button_validate() picking.button_validate()
@classmethod @classmethod
@@ -443,38 +444,39 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3, 3,
"Wrong qty to receive", "Wrong qty to receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_incoming, lines.filtered(lambda x: x.product_id == self.product_1).qty_incoming,
3, 3,
"Wrong qty incoming", "Wrong qty incoming",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5, 5,
"Wrong qty to receive", "Wrong qty to receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_incoming, lines.filtered(lambda x: x.product_id == self.product_2).qty_incoming,
5, 5,
"Wrong qty incoming", "Wrong qty incoming",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2, 2,
"Wrong qty to receive", "Wrong qty to receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_incoming, lines.filtered(lambda x: x.product_id == self.product_3).qty_incoming,
2, 2,
"Wrong qty incoming", "Wrong qty incoming",
) )
picking.action_assign() picking.action_assign()
for mv in picking.move_ids: for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done() picking._action_done()
lines = self.rma_customer_id.rma_line_ids lines = self.rma_customer_id.rma_line_ids
self.assertEqual( self.assertEqual(
@@ -491,32 +493,32 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received, lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3, 3,
"Wrong qty received", "Wrong qty received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3, 3,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received, lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5, 5,
"Wrong qty received", "Wrong qty received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5, 5,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received, lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2, 2,
"Wrong qty received", "Wrong qty received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2, 2,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
@@ -562,38 +564,39 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3, 3,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_outgoing, lines.filtered(lambda x: x.product_id == self.product_1).qty_outgoing,
3, 3,
"Wrong qty outgoing", "Wrong qty outgoing",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5, 5,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_outgoing, lines.filtered(lambda x: x.product_id == self.product_2).qty_outgoing,
5, 5,
"Wrong qty outgoing", "Wrong qty outgoing",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2, 2,
"Wrong qty to_deliver", "Wrong qty to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_outgoing, lines.filtered(lambda x: x.product_id == self.product_3).qty_outgoing,
2, 2,
"Wrong qty outgoing", "Wrong qty outgoing",
) )
picking.action_assign() picking.action_assign()
for mv in picking.move_ids: for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done() picking._action_done()
lines = self.rma_customer_id.rma_line_ids lines = self.rma_customer_id.rma_line_ids
self.assertEqual( self.assertEqual(
@@ -607,32 +610,32 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received, lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3, 3,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3, 3,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received, lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5, 5,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5, 5,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received, lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2, 2,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2, 2,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
@@ -702,17 +705,17 @@ class TestRma(common.TransactionCase):
self.assertEqual(list(set(lines.mapped("qty_delivered"))), [0], "qty_delivered") self.assertEqual(list(set(lines.mapped("qty_delivered"))), [0], "qty_delivered")
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3, 3,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5, 5,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2, 2,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
@@ -720,21 +723,21 @@ class TestRma(common.TransactionCase):
lines.env.invalidate_all() lines.env.invalidate_all()
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered( lines.filtered(
lambda l: l.product_id == self.product_1 lambda x: x.product_id == self.product_1
).qty_in_supplier_rma, ).qty_in_supplier_rma,
3, 3,
"Wrong qty_in_supplier_rma", "Wrong qty_in_supplier_rma",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered( lines.filtered(
lambda l: l.product_id == self.product_2 lambda x: x.product_id == self.product_2
).qty_in_supplier_rma, ).qty_in_supplier_rma,
5, 5,
"Wrong qty_in_supplier_rma", "Wrong qty_in_supplier_rma",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered( lines.filtered(
lambda l: l.product_id == self.product_3 lambda x: x.product_id == self.product_3
).qty_in_supplier_rma, ).qty_in_supplier_rma,
2, 2,
"Wrong qty_in_supplier_rma", "Wrong qty_in_supplier_rma",
@@ -791,32 +794,32 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3, 3,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3, 3,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5, 5,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5, 5,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2, 2,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2, 2,
"Wrong qty_to_deliver", "Wrong qty_to_deliver",
) )
@@ -825,7 +828,8 @@ class TestRma(common.TransactionCase):
) )
picking.action_assign() picking.action_assign()
for mv in picking.move_ids: for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done() picking._action_done()
self.assertEqual( self.assertEqual(
list(set(lines.mapped("qty_incoming"))), [0], "Wrong qty_incoming" list(set(lines.mapped("qty_incoming"))), [0], "Wrong qty_incoming"
@@ -839,37 +843,37 @@ class TestRma(common.TransactionCase):
self.assertEqual(list(set(lines.mapped("qty_outgoing"))), [0], "qty_outgoing") self.assertEqual(list(set(lines.mapped("qty_outgoing"))), [0], "qty_outgoing")
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3, 3,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3, 3,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received, lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
0, 0,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5, 5,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received, lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
0, 0,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2, 2,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received, lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
0, 0,
"Wrong qty_received", "Wrong qty_received",
) )
@@ -911,24 +915,25 @@ class TestRma(common.TransactionCase):
) )
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3, 3,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5, 5,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive, lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2, 2,
"Wrong qty_to_receive", "Wrong qty_to_receive",
) )
picking_in.action_confirm() picking_in.action_confirm()
picking_in.action_assign() picking_in.action_assign()
for mv in picking_in.move_line_ids: for mv in picking_in.move_line_ids:
mv.qty_done = mv.reserved_uom_qty mv.quantity = mv.quantity_product_uom
mv.picked = True
picking_in._action_done() picking_in._action_done()
self.assertEqual( self.assertEqual(
list(set(lines.mapped("qty_outgoing"))), [0], "Wrong qty_outgoing" list(set(lines.mapped("qty_outgoing"))), [0], "Wrong qty_outgoing"
@@ -942,32 +947,32 @@ class TestRma(common.TransactionCase):
# product specific # product specific
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3, 3,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received, lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3, 3,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5, 5,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received, lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5, 5,
"Wrong qty_received", "Wrong qty_received",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered, lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2, 2,
"Wrong qty_delivered", "Wrong qty_delivered",
) )
self._check_equal_quantity( self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received, lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2, 2,
"Wrong qty_received", "Wrong qty_received",
) )

View File

@@ -7,7 +7,7 @@
<field name="priority" eval="10" /> <field name="priority" eval="10" />
<field name="inherit_id" ref="base.res_config_settings_view_form" /> <field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside"> <xpath expr="//form" position="inside">
<div <div
class="app_settings_block" class="app_settings_block"
data-string="RMA" data-string="RMA"
@@ -27,7 +27,7 @@
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label for="group_rma_delivery_address" /> <label for="group_rma_delivery_address" />
<div class="text-muted"> <div class="text-muted">
Display 3 fields on rma: partner, invoice address, delivery address. Display 3 fields on rma: partner, invoice address, delivery address
</div> </div>
</div> </div>
</div> </div>

View File

@@ -24,7 +24,7 @@
name="web_ribbon" name="web_ribbon"
title="Archived" title="Archived"
bg_color="bg-danger" bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}" invisible="active == True"
/> />
<div class="oe_button_box" name="button_box" /> <div class="oe_button_box" name="button_box" />
<group colspan="4" col="2"> <group colspan="4" col="2">
@@ -51,7 +51,7 @@
/> />
<field <field
name="customer_to_supplier" name="customer_to_supplier"
attrs="{'invisible':[('type', '=', 'supplier')]}" invisible="type == 'supplier'"
/> />
</group> </group>
<group name="outbound" string="Outbound"> <group name="outbound" string="Outbound">
@@ -59,7 +59,7 @@
<field name="out_warehouse_id" /> <field name="out_warehouse_id" />
<field <field
name="supplier_to_customer" name="supplier_to_customer"
attrs="{'invisible':[('type', '=', 'customer')]}" invisible="type == 'customer'"
/> />
</group> </group>
</group> </group>

View File

@@ -61,7 +61,7 @@
name="action_rma_to_approve" name="action_rma_to_approve"
type="object" type="object"
string="Request Approval" string="Request Approval"
attrs="{'invisible':[('state', '!=', 'draft')]}" invisible="state != 'draft'"
class="oe_highlight" class="oe_highlight"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
@@ -69,14 +69,14 @@
name="action_rma_draft" name="action_rma_draft"
type="object" type="object"
string="Back to Draft" string="Back to Draft"
attrs="{'invisible':[('state', '=', 'draft')]}" invisible="state == 'draft'"
groups="rma.group_rma_customer_user,rma.group_rma_supplier_user" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"
/> />
<button <button
name="action_rma_approve" name="action_rma_approve"
type="object" type="object"
string="Approve" string="Approve"
attrs="{'invisible':[('state', '!=', 'to_approve')]}" invisible="state != 'to_approve'"
class="oe_highlight" class="oe_highlight"
groups="rma.group_rma_manager" groups="rma.group_rma_manager"
/> />
@@ -84,21 +84,21 @@
name="action_rma_approve" name="action_rma_approve"
type="object" type="object"
string="Back to Approved" string="Back to Approved"
attrs="{'invisible':[('state', '!=', 'done')]}" invisible="state != 'done'"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<button <button
name="action_rma_done" name="action_rma_done"
type="object" type="object"
string="Done" string="Done"
attrs="{'invisible':[('state', 'in', ('done', 'draft', 'canceled'))]}" invisible="state in ('done', 'draft', 'canceled')"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<button <button
name="action_rma_cancel" name="action_rma_cancel"
type="object" type="object"
string="Cancel" string="Cancel"
attrs="{'invisible':[('state', 'in', ('done', 'canceled'))]}" invisible="state in ('done', 'canceled')"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<field <field
@@ -115,7 +115,7 @@
name="action_view_in_shipments" name="action_view_in_shipments"
class="oe_stat_button" class="oe_stat_button"
icon="fa-truck" icon="fa-truck"
attrs="{'invisible': [('in_shipment_count', '=', 0)]}" invisible="in_shipment_count == 0"
groups="stock.group_stock_user" groups="stock.group_stock_user"
> >
<field <field
@@ -129,7 +129,7 @@
name="action_view_out_shipments" name="action_view_out_shipments"
class="oe_stat_button" class="oe_stat_button"
icon="fa-truck" icon="fa-truck"
attrs="{'invisible': [('out_shipment_count', '=', 0)]}" invisible="out_shipment_count == 0"
groups="stock.group_stock_user" groups="stock.group_stock_user"
> >
<field <field
@@ -150,7 +150,7 @@
class="oe_stat_button" class="oe_stat_button"
icon="fa-link" icon="fa-link"
groups="stock.group_stock_user" groups="stock.group_stock_user"
attrs="{'invisible': [('rma_line_count', '=', 0)]}" invisible="rma_line_count == 0"
> >
<field <field
name="rma_line_count" name="rma_line_count"
@@ -163,7 +163,7 @@
<h1> <h1>
<field <field
name="name" name="name"
readonly="1" readonly="state not in ['draft']"
invisible="context.get('hide_title',False)" invisible="context.get('hide_title',False)"
/> />
</h1> </h1>
@@ -174,6 +174,7 @@
name="partner_id" name="partner_id"
context="{'res_partner_search_mode': 'customer'}" context="{'res_partner_search_mode': 'customer'}"
string="Customer" string="Customer"
readonly="state not in ['draft']"
/> />
<field <field
name="delivery_address_id" name="delivery_address_id"
@@ -182,6 +183,7 @@
context="{'show_address': 1}" context="{'show_address': 1}"
options="{'always_reload': 1}" options="{'always_reload': 1}"
groups='rma.group_rma_delivery_invoice_address' groups='rma.group_rma_delivery_invoice_address'
readonly="state not in ['draft']"
/> />
</group> </group>
<group> <group>
@@ -195,22 +197,39 @@
</group> </group>
<group> <group>
<group name="product" string="Product"> <group name="product" string="Product">
<field name="product_id" /> <field
name="product_id"
readonly="state not in ['draft']"
/>
<newline /> <newline />
<field name="product_tracking" invisible="1" /> <field name="product_tracking" invisible="1" />
<field <field
name="lot_id" name="lot_id"
groups="stock.group_production_lot" groups="stock.group_production_lot"
attrs="{'required': [('product_tracking', 'in', ('serial', 'lot'))]}" required="product_tracking in ('serial', 'lot')"
context="{'default_product_id': product_id,}" context="{'default_product_id': product_id,}"
domain="[('product_id', '=', product_id)]" domain="[('product_id', '=', product_id)]"
readonly="state not in ['draft']"
/>
<field
name="under_warranty"
readonly="state not in ['draft']"
/> />
<field name="under_warranty" />
</group> </group>
<group name="product_qty" string="Quantity"> <group name="product_qty" string="Quantity">
<field name="product_qty" /> <field
<field name="uom_id" groups="uom.group_uom" /> name="product_qty"
<field name="price_unit" /> readonly="state not in ['draft']"
/>
<field
name="uom_id"
groups="uom.group_uom"
readonly="state not in ['draft']"
/>
<field
name="price_unit"
readonly="state not in ['draft']"
/>
</group> </group>
</group> </group>
<group name="main_info" string="Origin"> <group name="main_info" string="Origin">
@@ -220,6 +239,7 @@
domain="[('picking_id.partner_id', '=', partner_id), domain="[('picking_id.partner_id', '=', partner_id),
('location_dest_id.usage', '=', 'customer'), ('location_dest_id.usage', '=', 'customer'),
('state', '=', 'done')]" ('state', '=', 'done')]"
readonly="state not in ['draft']"
/> />
</group> </group>
<group> <group>
@@ -240,7 +260,7 @@
<group name="quantities" col="4" string="Quantities"> <group name="quantities" col="4" string="Quantities">
<group <group
name="receive" name="receive"
attrs="{'invisible': [('receipt_policy', '=', 'no')]}" invisible="receipt_policy == 'no'"
> >
<field name="qty_to_receive" /> <field name="qty_to_receive" />
<field name="qty_incoming" /> <field name="qty_incoming" />
@@ -248,7 +268,7 @@
</group> </group>
<group <group
name="deliver" name="deliver"
attrs="{'invisible': [('delivery_policy', '=', 'no')]}" invisible="delivery_policy == 'no'"
> >
<field name="qty_to_deliver" /> <field name="qty_to_deliver" />
<field name="qty_outgoing" /> <field name="qty_outgoing" />
@@ -256,7 +276,7 @@
</group> </group>
<group <group
name="supplier_rma" name="supplier_rma"
attrs="{'invisible':['|', ('type', '!=', 'customer'), ('customer_to_supplier','=',False)]}" invisible="type != 'customer' or not customer_to_supplier"
> >
<field name="qty_to_supplier_rma" /> <field name="qty_to_supplier_rma" />
<field name="qty_in_supplier_rma" /> <field name="qty_in_supplier_rma" />
@@ -265,50 +285,63 @@
</page> </page>
<page name="route" string="Routes"> <page name="route" string="Routes">
<group name="inbound" string="Inbound"> <group name="inbound" string="Inbound">
<field name="in_warehouse_id" /> <field
name="in_warehouse_id"
readonly="state not in ['draft']"
/>
<field <field
name="location_id" name="location_id"
domain="[('usage', '=', 'internal')]" domain="[('usage', '=', 'internal')]"
readonly="state not in ['draft']"
/> />
<field <field
name="in_route_id" name="in_route_id"
groups="stock.group_adv_location" groups="stock.group_adv_location"
readonly="state not in ['draft']"
/> />
<field <field
name="customer_to_supplier" name="customer_to_supplier"
attrs="{'invisible':[('type', '!=', 'customer')]}" invisible="type != 'customer'"
readonly="state not in ['draft']"
/> />
<field <field
name="supplier_address_id" name="supplier_address_id"
context="{'show_address': 1}" context="{'show_address': 1}"
options="{'always_reload': 1}" options="{'always_reload': 1}"
attrs="{'required':[('customer_to_supplier', '=', True)], required="customer_to_supplier == True"
'invisible':[('customer_to_supplier', '=', False)]}" invisible="customer_to_supplier == False"
readonly="state not in ['draft']"
/> />
</group> </group>
<group name="outbound" string="Outbound"> <group name="outbound" string="Outbound">
<field name="out_warehouse_id" /> <field
name="out_warehouse_id"
readonly="state not in ['draft']"
/>
<field <field
name="out_route_id" name="out_route_id"
groups="stock.group_adv_location" groups="stock.group_adv_location"
readonly="state not in ['draft']"
/> />
<field <field
name="supplier_to_customer" name="supplier_to_customer"
attrs="{'invisible':[('type', '!=', 'supplier')]}" invisible="type != 'supplier'"
readonly="state not in ['draft']"
/> />
<field <field
name="customer_address_id" name="customer_address_id"
context="{'show_address': 1}" context="{'show_address': 1}"
options="{'always_reload': 1}" options="{'always_reload': 1}"
attrs="{'required':[('supplier_to_customer', '=', True)], required="supplier_to_customer == True"
'invisible':[('supplier_to_customer', '=', False)]}" invisible="supplier_to_customer == False"
readonly="state not in ['draft']"
/> />
</group> </group>
</page> </page>
<page <page
name="stock" name="stock"
string="Stock Moves" string="Stock Moves"
attrs="{'invisible': [('move_ids', '=', [])]}" invisible="not move_ids"
> >
<field name="move_ids" nolabel="1" readonly="1" /> <field name="move_ids" nolabel="1" readonly="1" />
</page> </page>

View File

@@ -38,7 +38,7 @@
name="action_rma_to_approve" name="action_rma_to_approve"
type="object" type="object"
string="Request Approval" string="Request Approval"
attrs="{'invisible':[('state', '!=', 'draft')]}" invisible="state != 'draft'"
class="oe_highlight" class="oe_highlight"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
@@ -46,14 +46,14 @@
name="action_rma_draft" name="action_rma_draft"
type="object" type="object"
string="Back to Draft" string="Back to Draft"
attrs="{'invisible':[('state', '=', 'draft')]}" invisible="state == 'draft'"
groups="rma.group_rma_customer_user,rma.group_rma_supplier_user" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"
/> />
<button <button
name="action_rma_approve" name="action_rma_approve"
type="object" type="object"
string="Approve" string="Approve"
attrs="{'invisible':[('state', '!=', 'to_approve')]}" invisible="state != 'to_approve'"
class="oe_highlight" class="oe_highlight"
groups="rma.group_rma_manager" groups="rma.group_rma_manager"
/> />
@@ -61,21 +61,21 @@
name="action_rma_approve" name="action_rma_approve"
type="object" type="object"
string="Back to Approved" string="Back to Approved"
attrs="{'invisible':[('state', '!=', 'done')]}" invisible="state != 'done'"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<button <button
name="action_rma_done" name="action_rma_done"
type="object" type="object"
string="Done" string="Done"
attrs="{'invisible':[('state', 'in', ('done', 'draft', 'cancel'))]}" invisible="state in ('done', 'draft', 'cancel')"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<button <button
name="action_rma_cancel" name="action_rma_cancel"
type="object" type="object"
string="Cancel" string="Cancel"
attrs="{'invisible':[('state', 'in', ('done', 'cancel'))]}" invisible="state in ('done', 'cancel')"
groups="rma.group_rma_customer_user" groups="rma.group_rma_customer_user"
/> />
<field <field
@@ -126,7 +126,7 @@
type="object" type="object"
name="action_view_supplier_lines" name="action_view_supplier_lines"
class="oe_stat_button" class="oe_stat_button"
attrs="{'invisible':[('supplier_line_count', '=', 0)]}" invisible="supplier_line_count == 0"
icon="fa-list" icon="fa-list"
groups="rma.group_rma_supplier_user" groups="rma.group_rma_supplier_user"
> >
@@ -150,21 +150,12 @@
context="{'res_partner_search_mode': 'customer'}" context="{'res_partner_search_mode': 'customer'}"
string="Customer" string="Customer"
/> />
<field <field name="reference" invisible="type != 'supplier'" />
name="reference" <field name="date_rma" readonly="state != 'draft'" />
attrs="{'invisible':[('type', '!=', 'supplier')]}"
/>
<field
name="date_rma"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
</group> </group>
<group name="contact"> <group name="contact">
<field name="requested_by" readonly="1" /> <field name="requested_by" readonly="1" />
<field <field name="assigned_to" readonly="state != 'draft'" />
name="assigned_to"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field name="company_id" groups="base.group_multi_company" /> <field name="company_id" groups="base.group_multi_company" />
</group> </group>
</group> </group>
@@ -174,41 +165,32 @@
name="operation_default_id" name="operation_default_id"
domain="[('type','=','customer')]" domain="[('type','=','customer')]"
/> />
<field <field name="in_warehouse_id" readonly="state != 'draft'" />
name="in_warehouse_id" <field name="in_route_id" readonly="state != 'draft'" />
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field
name="in_route_id"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field <field
name="out_warehouse_id" name="out_warehouse_id"
invisible="1" invisible="1"
attrs="{'readonly':[('state', '!=', 'draft')]}" readonly="state != 'draft'"
/>
<field
name="location_id"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/> />
<field name="location_id" readonly="state != 'draft'" />
<field <field
name="out_route_id" name="out_route_id"
invisible="1" invisible="1"
attrs="{'readonly':[('state', '!=', 'draft')]}" readonly="state != 'draft'"
/> />
<field <field
name="customer_to_supplier" name="customer_to_supplier"
attrs="{'readonly':[('state', '!=', 'draft')], readonly="state != 'draft'"
'invisible':[('type', '!=', 'customer')]}" invisible="type != 'customer'"
/> />
<field name="state" invisible="1" /> <field name="state" invisible="1" />
<field <field
name="supplier_address_id" name="supplier_address_id"
context="{'show_address': 1}" context="{'show_address': 1}"
options="{'always_reload': 1}" options="{'always_reload': 1}"
attrs="{'required':[('customer_to_supplier', '=', True)], required="customer_to_supplier == True"
'invisible':[('customer_to_supplier', '=', False)], invisible="customer_to_supplier == False"
'readonly':[('state', '!=', 'draft')]}" readonly="state != 'draft'"
/> />
</group> </group>
</group> </group>
@@ -228,7 +210,7 @@
<page string="RMA Lines" name="lines"> <page string="RMA Lines" name="lines">
<field <field
name="rma_line_ids" name="rma_line_ids"
context="{'default_rma_id': active_id, context="{'default_rma_id': id,
'default_partner_id': partner_id, 'default_partner_id': partner_id,
'hide_title': True}" 'hide_title': True}"
> >
@@ -299,24 +281,21 @@
</field> </field>
<group name="inbound_route" position="after"> <group name="inbound_route" position="after">
<group name="outbound_route" string="Outbound"> <group name="outbound_route" string="Outbound">
<field <field name="supplier_to_customer" readonly="state != 'draft'" />
name="supplier_to_customer"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field <field
name="customer_address_id" name="customer_address_id"
context="{'show_address': 1}" context="{'show_address': 1}"
options="{'always_reload': 1}" options="{'always_reload': 1}"
attrs="{'required':[('supplier_to_customer', '=', True)], required="supplier_to_customer == True"
'invisible':[('supplier_to_customer', '=', False)], invisible="supplier_to_customer == False"
'readonly':[('state', '!=', 'draft')]}" readonly="state != 'draft'"
/> />
</group> </group>
</group> </group>
<field name="rma_line_ids" position="attributes"> <field name="rma_line_ids" position="attributes">
<attribute name="context">{ <attribute name="context">{
'form_view_ref':'rma.view_rma_line_supplier_form', 'form_view_ref':'rma.view_rma_line_supplier_form',
'default_rma_id': active_id, 'default_rma_id': id,
'default_partner_id': partner_id, 'default_partner_id': partner_id,
'supplier': 1, 'supplier': 1,
'hide_title': True} 'hide_title': True}

View File

@@ -55,7 +55,7 @@
name="%(action_rma_add_serial_wiz_customer)d" name="%(action_rma_add_serial_wiz_customer)d"
string="Add Lot/Serial Numbers" string="Add Lot/Serial Numbers"
type="action" type="action"
attrs="{'invisible':[('type', '!=', 'customer')]}" invisible="type != 'customer'"
/> />
</xpath> </xpath>
</field> </field>
@@ -93,7 +93,7 @@
name="%(action_rma_add_serial_wiz_supplier)d" name="%(action_rma_add_serial_wiz_supplier)d"
string="Add Lot/Serial numbers" string="Add Lot/Serial numbers"
type="action" type="action"
attrs="{'invisible':[('type', '!=', 'supplier')]}" invisible="type != 'supplier'"
/> />
</xpath> </xpath>
</field> </field>

View File

@@ -11,7 +11,7 @@ class RmaAddStockMove(models.TransientModel):
@api.model @api.model
def default_get(self, fields_list): def default_get(self, fields_list):
res = super(RmaAddStockMove, self).default_get(fields_list) res = super().default_get(fields_list)
rma_obj = self.env["rma.order"] rma_obj = self.env["rma.order"]
rma_id = self.env.context["active_ids"] or [] rma_id = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"] active_model = self.env.context["active_model"]
@@ -192,8 +192,8 @@ class RmaAddStockMove(models.TransientModel):
# Ensure that configuration on the operation is applied (like # Ensure that configuration on the operation is applied (like
# policies). # policies).
# TODO MIG: in v16 the usage of such onchange can be removed in # TODO MIG: in v16 the usage of such onchange can be removed in
# favor of (pre)computed stored editable fields for all policies # favor of (pre)computed stored editable fields for all
# and configuration in the RMA operation. # policies and configuration in the RMA operation.
rec._onchange_operation_id() rec._onchange_operation_id()
rec.price_unit = rec._get_price_unit() rec.price_unit = rec._get_price_unit()
return {"type": "ir.actions.act_window_close"} return {"type": "ir.actions.act_window_close"}

View File

@@ -34,23 +34,20 @@
</field> </field>
<field name="show_lot_filter" invisible="1" /> <field name="show_lot_filter" invisible="1" />
<field name="lot_domain_ids" widget="many2many_tags" invisible="1" /> <field name="lot_domain_ids" widget="many2many_tags" invisible="1" />
<div <div class="oe_grey" invisible="show_lot_filter == False">
class="oe_grey"
attrs="{'invisible': [('show_lot_filter', '=', False)]}"
>
The creation of the RMA Lines will be separated according to the lots or serials selected The creation of the RMA Lines will be separated according to the lots or serials selected
</div> </div>
<div class="o_row"> <div class="o_row">
<label <label
for="lot_ids" for="lot_ids"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
string="Selected Lot/Serial Numbers" string="Selected Lot/Serial Numbers"
/> />
<field <field
name="lot_ids" name="lot_ids"
widget="many2many_tags" widget="many2many_tags"
domain="[('id', 'in', lot_domain_ids)]" domain="[('id', 'in', lot_domain_ids)]"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
options="{'no_create': True}" options="{'no_create': True}"
/> />
<button <button
@@ -58,7 +55,7 @@
type="object" type="object"
string="Select all" string="Select all"
class="oe_inline" class="oe_inline"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
/> />
</div> </div>
<footer> <footer>
@@ -101,7 +98,7 @@
name="%(action_rma_add_stock_move_customer)d" name="%(action_rma_add_stock_move_customer)d"
string="Add From Stock Move" string="Add From Stock Move"
type="action" type="action"
attrs="{'invisible':[('type', '!=', 'customer')]}" invisible="type != 'customer'"
/> />
</xpath> </xpath>
</field> </field>
@@ -125,14 +122,14 @@
<div class="o_row"> <div class="o_row">
<label <label
for="lot_ids" for="lot_ids"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
string="Selected Lot/Serial Numbers" string="Selected Lot/Serial Numbers"
/> />
<field <field
name="lot_ids" name="lot_ids"
widget="many2many_tags" widget="many2many_tags"
domain="[('id', 'in', lot_domain_ids)]" domain="[('id', 'in', lot_domain_ids)]"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
options="{'no_create': True}" options="{'no_create': True}"
/> />
<button <button
@@ -140,7 +137,7 @@
type="object" type="object"
string="Select all" string="Select all"
class="oe_inline" class="oe_inline"
attrs="{'invisible': [('show_lot_filter', '=', False)]}" invisible="show_lot_filter == False"
/> />
</div> </div>
<footer> <footer>
@@ -182,7 +179,7 @@
name="%(action_rma_add_stock_move_supplier)d" name="%(action_rma_add_stock_move_supplier)d"
string="Add From Stock Move" string="Add From Stock Move"
type="action" type="action"
attrs="{'invisible':[('type', '!=', 'supplier')]}" invisible="type != 'supplier'"
/> />
</xpath> </xpath>
</field> </field>

View File

@@ -33,7 +33,7 @@ class RmaMakePicking(models.TransientModel):
supplier. supplier.
""" """
context = self._context.copy() context = self._context.copy()
res = super(RmaMakePicking, self).default_get(fields_list) res = super().default_get(fields_list)
rma_line_obj = self.env["rma.order.line"] rma_line_obj = self.env["rma.order.line"]
rma_line_ids = self.env.context["active_ids"] or [] rma_line_ids = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"] active_model = self.env.context["active_model"]
@@ -237,11 +237,13 @@ class RmaMakePicking(models.TransientModel):
elif move.product_id.tracking == "lot": elif move.product_id.tracking == "lot":
if picking_type == "incoming": if picking_type == "incoming":
qty = self.item_ids.filtered( qty = self.item_ids.filtered(
lambda x: x.line_id.id == move.rma_line_id.id lambda x, move_rma_line_id=move.rma_line_id: x.line_id.id
== move_rma_line_id.id
).qty_to_receive ).qty_to_receive
else: else:
qty = self.item_ids.filtered( qty = self.item_ids.filtered(
lambda x: x.line_id.id == move.rma_line_id.id lambda x, move_rma_line_id=move.rma_line_id: x.line_id.id
== move_rma_line_id.id
).qty_to_deliver ).qty_to_deliver
move_line_data = move._prepare_move_line_vals() move_line_data = move._prepare_move_line_vals()
move_line_data.update( move_line_data.update(

View File

@@ -108,26 +108,26 @@
name="%(action_rma_picking_in)d" name="%(action_rma_picking_in)d"
string="Create Incoming Shipment" string="Create Incoming Shipment"
class="oe_highlight" class="oe_highlight"
attrs="{'invisible':['|', '|', '|', ('qty_to_receive', '=', 0), ('qty_to_receive', '&lt;', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}" invisible="qty_to_receive == 0 or qty_to_receive &lt; 0 or state != 'approved' or receipt_policy == 'no'"
type="action" type="action"
/> />
<button <button
name="%(action_rma_picking_in)d" name="%(action_rma_picking_in)d"
string="Create Incoming Shipment" string="Create Incoming Shipment"
attrs="{'invisible':['|', '|', ('qty_to_receive', '>', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}" invisible="qty_to_receive &gt; 0 or state != 'approved' or receipt_policy == 'no'"
type="action" type="action"
/> />
<button <button
name="%(action_rma_picking_out)d" name="%(action_rma_picking_out)d"
string="Create Delivery" string="Create Delivery"
class="oe_highlight" class="oe_highlight"
attrs="{'invisible':['|', '|', '|', ('qty_to_deliver', '=', 0), ('qty_to_deliver', '&lt;', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}" invisible="qty_to_deliver == 0 or qty_to_deliver &lt; 0 or state != 'approved' or delivery_policy == 'no'"
type="action" type="action"
/> />
<button <button
name="%(action_rma_picking_out)d" name="%(action_rma_picking_out)d"
string="Create Delivery" string="Create Delivery"
attrs="{'invisible':['|', '|', ('qty_to_deliver', '>', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}" invisible="qty_to_deliver &gt; 0 or state != 'approved' or delivery_policy == 'no'"
type="action" type="action"
/> />
</header> </header>

View File

@@ -50,7 +50,7 @@ class RmaLineMakeSupplierRma(models.TransientModel):
@api.model @api.model
def default_get(self, fields_list): def default_get(self, fields_list):
res = super(RmaLineMakeSupplierRma, self).default_get(fields_list) res = super().default_get(fields_list)
rma_line_obj = self.env["rma.order.line"] rma_line_obj = self.env["rma.order.line"]
rma_line_ids = self.env.context["active_ids"] or [] rma_line_ids = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"] active_model = self.env.context["active_model"]

View File

@@ -68,7 +68,7 @@
<button <button
name="%(action_rma_order_line_make_supplier_rma)d" name="%(action_rma_order_line_make_supplier_rma)d"
string="Create Supplier RMA" string="Create Supplier RMA"
attrs="{'invisible':['|', ('type', '!=', 'customer'), ('state', '!=', 'approved')]}" invisible="type != 'customer' or state != 'approved'"
type="action" type="action"
/> />
</header> </header>