Skip to content

Commit

Permalink
[MIG] rma: Migration to v17
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronHForgeFlow committed Nov 17, 2023
1 parent 2d73adf commit 62cf3c6
Show file tree
Hide file tree
Showing 21 changed files with 919 additions and 198 deletions.
661 changes: 661 additions & 0 deletions rma/LICENSE

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions rma/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/&target_branch=17.0)
[![Pre-commit Status](https://github.com/OCA//actions/workflows/pre-commit.yml/badge.svg?branch=17.0)](https://github.com/OCA//actions/workflows/pre-commit.yml?query=branch%3A17.0)
[![Build Status](https://github.com/OCA//actions/workflows/test.yml/badge.svg?branch=17.0)](https://github.com/OCA//actions/workflows/test.yml?query=branch%3A17.0)
[![codecov](https://codecov.io/gh/OCA//branch/17.0/graph/badge.svg)](https://codecov.io/gh/OCA/)
[![Translation Status](https://translation.odoo-community.org/widgets/-17-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/-17-0/?utm_source=widget)

<!-- /!\ do not modify above this line -->

#

<!-- /!\ do not modify below this line -->

<!-- prettier-ignore-start -->

[//]: # (addons)

This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools.

[//]: # (end addons)

<!-- prettier-ignore-end -->

## Licenses

This repository is licensed under [AGPL-3.0](LICENSE).

However, each module can have a totally different license, as long as they adhere to
Odoo Community Association (OCA) policy. Consult each module's `__manifest__.py` file,
which contains a `license` key that explains its license.

---

OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit
organization whose mission is to support the collaborative development of Odoo features
and promote its widespread use.
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
59 changes: 20 additions & 39 deletions rma/models/rma_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ def _compute_rma_line_count(self):
delivery_address_id = fields.Many2one(
comodel_name="res.partner",
string="Partner delivery address",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
help="This address will be used to deliver repaired or replacement "
"products.",
)
Expand All @@ -246,17 +245,15 @@ def _compute_rma_line_count(self):
string="Reference",
required=True,
default="/",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
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)]},
readonly="state != 'draft'",
help="Reference of the document that produced this rma.",
)
state = fields.Selection(
Expand Down Expand Up @@ -291,8 +288,7 @@ def _compute_rma_line_count(self):
required=True,
store=True,
tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
sequence = fields.Integer(
default=10, help="Gives the sequence of this line when displaying the rma."
Expand All @@ -301,38 +297,33 @@ def _compute_rma_line_count(self):
comodel_name="product.product",
ondelete="restrict",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
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)]},
readonly="state != 'draft'",
)
product_qty = fields.Float(
string="Return Qty",
copy=False,
default=1.0,
digits="Product Unit of Measure",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
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)]},
readonly="state != 'draft'",
)
price_unit = fields.Monetary(
string="Unit cost",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
help="Unit cost of the items under RMA",
)
in_shipment_count = fields.Integer(
Expand All @@ -348,8 +339,7 @@ def _compute_rma_line_count(self):
comodel_name="stock.move",
string="Originating Stock Move",
copy=False,
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
currency_id = fields.Many2one(
"res.currency",
Expand All @@ -368,13 +358,11 @@ def _compute_rma_line_count(self):
)
customer_to_supplier = fields.Boolean(
"The customer will send to the supplier",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
supplier_to_customer = fields.Boolean(
"The supplier will send to the customer",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
)
receipt_policy = fields.Selection(
[
Expand Down Expand Up @@ -402,45 +390,40 @@ def _compute_rma_line_count(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)]},
readonly="state != 'draft'",
)
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)]},
readonly="state != 'draft'",
)
in_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse",
string="Inbound Warehouse",
required=True,
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
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)]},
readonly="state != 'draft'",
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)]},
readonly="state != 'draft'",
default=lambda self: self._default_location_id(),
)
customer_rma_id = fields.Many2one(
Expand All @@ -452,15 +435,13 @@ def _compute_rma_line_count(self):
)
supplier_address_id = fields.Many2one(
comodel_name="res.partner",
readonly=True,
states={"draft": [("readonly", False)]},
readonly="state != 'draft'",
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)]},
readonly="state != 'draft'",
string="Customer Address",
help="Address of the customer in case of Supplier RMA operation " "dropship.",
)
Expand Down Expand Up @@ -520,7 +501,7 @@ def _compute_rma_line_count(self):
store=True,
)
under_warranty = fields.Boolean(
string="Under Warranty?", readonly=True, states={"draft": [("readonly", False)]}
string="Under Warranty?", readonly="state != 'draft'"
)

def _prepare_rma_line_from_stock_move(self, sm, lot=False):
Expand Down
4 changes: 2 additions & 2 deletions rma/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def write(self, vals):
{
"name": "RMA",
"usage": "internal",
"location_id": wh.view_location_id.id,
"location_id": wh.lot_stock_id.id,
"company_id": wh.company_id.id,
}
)
Expand All @@ -90,7 +90,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
6 changes: 3 additions & 3 deletions rma/report/report_deliveryslip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
</template>

<template
id="stock_report_delivery_has_serial_move_line"
id="stock_report_delivery_has_serial_move_line_inherit_product_expiry"
inherit_id="stock.stock_report_delivery_has_serial_move_line"
>
<xpath expr="//td[@name='move_line_lot_qty_done']" position="before">
<xpath expr="//t[@name='move_line_lot']" position="after">
<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
2 changes: 1 addition & 1 deletion rma/report/rma_report_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<table class="table table-condensed">
<thead>
<tr>
<th name="product" invisible="1">Product</th>
<th name="product" invisible="True">Product</th>
<th name="lot" t-if="doc.lot_id">Lot/Serial Number</th>
<th name="quantity" class="text-right">Quantity</th>
<th name="unit_price" class="text-right">Unit Price</th>
Expand Down
Binary file modified rma/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 62cf3c6

Please sign in to comment.