mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[MIG] rma_sale_mrp: Migration to 13.0
[UPD] Update rma_sale_mrp.pot [UPD] README.rst
This commit is contained in:
@@ -14,13 +14,13 @@ Return Merchandise Authorization Management - Link with MRP Kits
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/rma/tree/12.0/rma_sale_mrp
|
||||
:target: https://github.com/OCA/rma/tree/13.0/rma_sale_mrp
|
||||
:alt: OCA/rma
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale_mrp
|
||||
:target: https://translation.odoo-community.org/projects/rma-13-0/rma-13-0-rma_sale_mrp
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/145/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/145/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -74,7 +74,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_sale_mrp%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_sale_mrp%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@@ -114,6 +114,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-chienandalu|
|
||||
|
||||
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/12.0/rma_sale_mrp>`_ project on GitHub.
|
||||
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/13.0/rma_sale_mrp>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "Return Merchandise Authorization Management - Link with MRP Kits",
|
||||
"summary": "Allow doing RMAs from MRP kits",
|
||||
"version": "12.0.1.0.2",
|
||||
"version": "13.0.1.0.0",
|
||||
"development_status": "Beta",
|
||||
"category": "RMA",
|
||||
"website": "https://github.com/OCA/rma",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * rma_sale_mrp
|
||||
# * rma_sale_mrp
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -15,17 +15,23 @@ msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
|
||||
msgid "<span class=\"badge badge-danger label-text-align\"><i class=\"fa fa-fw fa-times\"/> Cancelled</span>"
|
||||
msgid ""
|
||||
"<span class=\"badge badge-danger label-text-align\"><i class=\"fa fa-fw fa-"
|
||||
"times\"/> Cancelled</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
|
||||
msgid "<span class=\"badge badge-info label-text-align\"><i class=\"fa fa-fw fa-clock-o\"/> Draft</span>"
|
||||
msgid ""
|
||||
"<span class=\"badge badge-info label-text-align\"><i class=\"fa fa-fw fa-"
|
||||
"clock-o\"/> Draft</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
|
||||
msgid "<span class=\"badge badge-warning label-text-align\"><i class=\"fa fa-fw fa-clock-o\"/> Waiting</span>"
|
||||
msgid ""
|
||||
"<span class=\"badge badge-warning label-text-align\"><i class=\"fa fa-fw fa-"
|
||||
"clock-o\"/> Waiting</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
@@ -101,7 +107,9 @@ msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard_component__uom_category_id
|
||||
msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios."
|
||||
msgid ""
|
||||
"Conversion between Units of Measure can only occur if they belong to the "
|
||||
"same category. The conversion will be made based on the ratios."
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
@@ -135,8 +143,8 @@ msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model,name:rma_sale_mrp.model_account_invoice
|
||||
msgid "Invoice"
|
||||
#: model:ir.model,name:rma_sale_mrp.model_account_move
|
||||
msgid "Journal Entries"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
@@ -233,11 +241,6 @@ msgstr ""
|
||||
msgid "Sale Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model,name:rma_sale_mrp.model_sale_order
|
||||
msgid "Sale Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model,name:rma_sale_mrp.model_sale_order_line_rma_wizard
|
||||
msgid "Sale Order Line Rma Wizard"
|
||||
@@ -248,20 +251,29 @@ msgstr ""
|
||||
msgid "Sale Order Rma Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model,name:rma_sale_mrp.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model,name:rma_sale_mrp.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:55
|
||||
#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:0
|
||||
#, python-format
|
||||
msgid "The kit corresponding to the product %s can't be put in the RMA. Either all or some of the components where already put in another RMA"
|
||||
msgid ""
|
||||
"The kit corresponding to the product %s can't be put in the RMA. Either all "
|
||||
"or some of the components where already put in another RMA"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty
|
||||
msgid "To how many kits this components corresponds to. Used mainly for refunding the right quantity"
|
||||
msgid ""
|
||||
"To how many kits this components corresponds to. Used mainly for refunding "
|
||||
"the right quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
@@ -286,8 +298,7 @@ msgid "Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: rma_sale_mrp
|
||||
#: code:addons/rma_sale_mrp/models/rma.py:49
|
||||
#: code:addons/rma_sale_mrp/models/rma.py:0
|
||||
#, python-format
|
||||
msgid "You can't refund a kit in wich some RMAs aren't received"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from . import account_invoice
|
||||
from . import account_move
|
||||
from . import rma
|
||||
from . import sale_order
|
||||
|
||||
@@ -4,8 +4,8 @@ from odoo import models
|
||||
from odoo.tools import float_compare
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = "account.invoice"
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def _check_rma_invoice_lines_qty(self):
|
||||
"""For those with differences, check if the kit quantity is the same"""
|
||||
@@ -3,8 +3,6 @@
|
||||
from odoo import _, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
|
||||
|
||||
class Rma(models.Model):
|
||||
_inherit = "rma"
|
||||
@@ -14,7 +12,7 @@ class Rma(models.Model):
|
||||
)
|
||||
kit_qty = fields.Float(
|
||||
string="Kit quantity",
|
||||
digits=dp.get_precision("Product Unit of Measure"),
|
||||
digits="Product Unit of Measure",
|
||||
readonly=True,
|
||||
help="To how many kits this components corresponds to. Used mainly "
|
||||
"for refunding the right quantity",
|
||||
|
||||
@@ -73,7 +73,7 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
def get_delivery_move(self):
|
||||
self.ensure_one()
|
||||
if self.product_id and not self.product_id._is_phantom_bom():
|
||||
if self.product_id and not self._rma_is_kit_product():
|
||||
return super().get_delivery_move()
|
||||
return self.move_ids.filtered(
|
||||
lambda m: (
|
||||
@@ -92,7 +92,7 @@ class SaleOrderLine(models.Model):
|
||||
can play with them when filtering or showing to the customer"""
|
||||
self.ensure_one()
|
||||
data = super().prepare_sale_rma_data()
|
||||
if self.product_id and self.product_id._is_phantom_bom():
|
||||
if self.product_id and self._rma_is_kit_product():
|
||||
for d in data:
|
||||
d.update(
|
||||
{
|
||||
@@ -107,7 +107,11 @@ class SaleOrderLine(models.Model):
|
||||
rely on the matching of sale order and pickings demands, but if those
|
||||
were manually changed, it could lead to inconsistencies"""
|
||||
self.ensure_one()
|
||||
if self.product_id and not self.product_id._is_phantom_bom():
|
||||
if (
|
||||
self.product_id
|
||||
and not self._rma_is_kit_product()
|
||||
or not self.product_uom_qty
|
||||
):
|
||||
return 0
|
||||
component_demand = sum(
|
||||
self.move_ids.filtered(
|
||||
@@ -115,3 +119,17 @@ class SaleOrderLine(models.Model):
|
||||
).mapped("product_uom_qty")
|
||||
)
|
||||
return component_demand / self.product_uom_qty
|
||||
|
||||
def _rma_is_kit_product(self):
|
||||
"""The method _is_phantom_bom isn't available anymore. We wan't to use
|
||||
the same rule Odoo does in core"""
|
||||
bom = (
|
||||
self.env["mrp.bom"]
|
||||
.sudo()
|
||||
._bom_find(
|
||||
product=self.product_id,
|
||||
company_id=self.company_id.id,
|
||||
bom_type="phantom",
|
||||
)
|
||||
)
|
||||
return bom and bom.type == "phantom"
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/rma/tree/12.0/rma_sale_mrp"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale_mrp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/145/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/rma/tree/13.0/rma_sale_mrp"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-13-0/rma-13-0-rma_sale_mrp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/145/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module enables RMAs for kits, wich isn’t compatible with the base modules.
|
||||
In the backend side, we can return separate component while in the frontend
|
||||
side, customers can return the whole kit and the proper RMAs will be generated.</p>
|
||||
@@ -423,7 +423,7 @@ version to use the same rules so they fail for the same reasons.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rma/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/rma/issues/new?body=module:%20rma_sale_mrp%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/rma/issues/new?body=module:%20rma_sale_mrp%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -452,7 +452,7 @@ mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rma/tree/12.0/rma_sale_mrp">OCA/rma</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rma/tree/13.0/rma_sale_mrp">OCA/rma</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -131,7 +131,7 @@ class TestRmaSaleMrp(SavepointCase):
|
||||
self.assertEqual(rma.refund_id, rmas_left.mapped("refund_id"))
|
||||
# The refund product is the kit, not the components
|
||||
self.assertEqual(rma.refund_id.invoice_line_ids.product_id, self.product_kit)
|
||||
rma.refund_id.action_invoice_open()
|
||||
rma.refund_id.post()
|
||||
# We can still return another kit
|
||||
wizard_id = order.action_create_rma()["res_id"]
|
||||
wizard = self.env["sale.order.rma.wizard"].browse(wizard_id)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="rma_view_form" model="ir.ui.view">
|
||||
<field name="inherit_id" ref="rma_sale.rma_view_form" />
|
||||
<field name="model">rma</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="before">
|
||||
<field name="phantom_bom_product" attrs="{'invisible': [('phantom_bom_product', '=', False)]}" />
|
||||
<field
|
||||
name="phantom_bom_product"
|
||||
attrs="{'invisible': [('phantom_bom_product', '=', False)]}"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -14,7 +17,7 @@
|
||||
<field name="model">rma</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_uom" position="after">
|
||||
<field name="phantom_bom_product"/>
|
||||
<field name="phantom_bom_product" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -98,7 +98,8 @@ class SaleOrderLineRmaWizard(models.TransientModel):
|
||||
"""We need to process kit components separately so we can match them
|
||||
against their phantom product"""
|
||||
not_kit = self.filtered(
|
||||
lambda x: not x.phantom_bom_product and not x.product_id._is_phantom_bom()
|
||||
lambda x: not x.phantom_bom_product
|
||||
and not x.sale_line_id._rma_is_kit_product()
|
||||
)
|
||||
super(SaleOrderLineRmaWizard, not_kit)._compute_move_id()
|
||||
for line in self.filtered(lambda x: x.phantom_bom_product and x.picking_id):
|
||||
|
||||
Reference in New Issue
Block a user