Skip to content

Commit

Permalink
[MIG] rma: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosVForgeFlow committed Mar 12, 2024
1 parent 46fa1f6 commit 775b519
Show file tree
Hide file tree
Showing 19 changed files with 1,352 additions and 208 deletions.
1,171 changes: 1,171 additions & 0 deletions c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rma/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RMA (Return Merchandise Authorization)
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2a063cc1f6e65fa97dd68c83a5086cedca60cc1110a9a8c7fa55a665f6341339
!! source digest: sha256:320013d460e1f02cfc3ff65322457095d8a01aa5d18f2e850b3c7174c16b9bdd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion rma/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "RMA (Return Merchandise Authorization)",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"category": "RMA",
"summary": "Introduces the return merchandise authorization (RMA) process in odoo",
Expand Down
42 changes: 1 addition & 41 deletions rma/models/rma_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ def _default_date_rma(self):
delivery_address_id = fields.Many2one(
comodel_name="res.partner",
string="Partner delivery address",
readonly=True,
states={"draft": [("readonly", False)]},
help="This address will be used to deliver repaired or replacement "
"products.",
)
Expand All @@ -250,17 +248,13 @@ def _default_date_rma(self):
string="Reference",
required=True,
default="/",
readonly=True,
states={"draft": [("readonly", False)]},
help="Add here the supplier RMA #. Otherwise an internal code is" " assigned.",
copy=False,
)
description = fields.Text()
conditions = fields.Html(string="Terms and conditions")
origin = fields.Char(
string="Source Document",
readonly=True,
states={"draft": [("readonly", False)]},
help="Reference of the document that produced this rma.",
)
date_rma = fields.Datetime(
Expand Down Expand Up @@ -298,8 +292,6 @@ def _default_date_rma(self):
required=True,
store=True,
tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
sequence = fields.Integer(
default=10, help="Gives the sequence of this line when displaying the rma."
Expand All @@ -308,38 +300,28 @@ def _default_date_rma(self):
comodel_name="product.product",
ondelete="restrict",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
product_tracking = fields.Selection(related="product_id.tracking")
lot_id = fields.Many2one(
comodel_name="stock.lot",
string="Lot/Serial Number",
readonly=True,
states={"draft": [("readonly", False)]},
)
product_qty = fields.Float(
string="Return Qty",
copy=False,
default=1.0,
digits="Product Unit of Measure",
readonly=True,
states={"draft": [("readonly", False)]},
)
uom_id = fields.Many2one(
comodel_name="uom.uom",
string="Unit of Measure",
required=True,
readonly=True,
compute="_compute_uom_id",
precompute=True,
store=True,
states={"draft": [("readonly", False)]},
)
price_unit = fields.Monetary(
string="Unit cost",
readonly=True,
states={"draft": [("readonly", False)]},
help="Unit cost of the items under RMA",
)
in_shipment_count = fields.Integer(
Expand All @@ -355,8 +337,6 @@ def _default_date_rma(self):
comodel_name="stock.move",
string="Originating Stock Move",
copy=False,
readonly=True,
states={"draft": [("readonly", False)]},
)
currency_id = fields.Many2one(
"res.currency",
Expand All @@ -375,13 +355,9 @@ def _default_date_rma(self):
)
customer_to_supplier = fields.Boolean(
"The customer will send to the supplier",
readonly=True,
states={"draft": [("readonly", False)]},
)
supplier_to_customer = fields.Boolean(
"The supplier will send to the customer",
readonly=True,
states={"draft": [("readonly", False)]},
)
receipt_policy = fields.Selection(
[
Expand Down Expand Up @@ -409,45 +385,35 @@ def _default_date_rma(self):
string="Inbound Route",
required=True,
domain=[("rma_selectable", "=", True)],
readonly=True,
compute="_compute_in_route_id",
precompute=True,
store=True,
states={"draft": [("readonly", False)]},
)
out_route_id = fields.Many2one(
"stock.route",
string="Outbound Route",
required=True,
domain=[("rma_selectable", "=", True)],
readonly=True,
compute="_compute_out_route_id",
precompute=True,
store=True,
states={"draft": [("readonly", False)]},
)
in_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse",
string="Inbound Warehouse",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_warehouse_id(),
)
out_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse",
string="Outbound Warehouse",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_warehouse_id(),
)
location_id = fields.Many2one(
comodel_name="stock.location",
string="Send To This Company Location",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
default=lambda self: self._default_location_id(),
)
customer_rma_id = fields.Many2one(
Expand All @@ -459,15 +425,11 @@ def _default_date_rma(self):
)
supplier_address_id = fields.Many2one(
comodel_name="res.partner",
readonly=True,
states={"draft": [("readonly", False)]},
string="Supplier Address",
help="Address of the supplier in case of Customer RMA operation " "dropship.",
)
customer_address_id = fields.Many2one(
comodel_name="res.partner",
readonly=True,
states={"draft": [("readonly", False)]},
string="Customer Address",
help="Address of the customer in case of Supplier RMA operation " "dropship.",
)
Expand Down Expand Up @@ -526,9 +488,7 @@ def _default_date_rma(self):
compute="_compute_qty_supplier_rma",
store=True,
)
under_warranty = fields.Boolean(
string="Under Warranty?", readonly=True, states={"draft": [("readonly", False)]}
)
under_warranty = fields.Boolean(string="Under Warranty?")

def _prepare_rma_line_from_stock_move(self, sm, lot=False):
if not self.type:
Expand Down
4 changes: 2 additions & 2 deletions rma/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def _get_available_quantity(
def _update_reserved_quantity(
self,
need,
available_quantity,
location_id,
quant_ids=None,
lot_id=None,
package_id=None,
owner_id=None,
Expand All @@ -93,8 +93,8 @@ def _update_reserved_quantity(
lot_id = self.rma_line_id.lot_id
return super()._update_reserved_quantity(
need,
available_quantity,
location_id,
quant_ids=quant_ids,
lot_id=lot_id,
package_id=package_id,
owner_id=owner_id,
Expand Down
2 changes: 1 addition & 1 deletion rma/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def write(self, vals):
self.mapped("rma_customer_out_pull_id").unlink()
self.mapped("rma_supplier_in_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):
picking_type_obj = self.env["stock.picking.type"]
Expand Down
4 changes: 2 additions & 2 deletions rma/report/report_deliveryslip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
id="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">
<span t-field="move_line.move_id.rma_line_id" />
</td>
Expand All @@ -45,7 +45,7 @@
id="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">
<!-- TODO: To be implemented.
It will require de extension _get_aggregated_product_quantities
Expand Down
Loading

0 comments on commit 775b519

Please sign in to comment.