Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] rma_account #559

Open
wants to merge 103 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
c6118e6
init branch
JordiBForgeFlow Jul 27, 2017
a75384d
[9.0][FIX] rma:
LoisRForgeFlow Aug 2, 2017
5eb2d33
[IMP] default operation in product and product_categ for customer and…
AaronHForgeFlow Aug 16, 2017
415bdfb
[9.0][IMP] rma_account:
LoisRForgeFlow Aug 25, 2017
003203b
pylint
LoisRForgeFlow Oct 30, 2017
610c5b6
[9.0][REW] rma_account: adapt.
LoisRForgeFlow Oct 18, 2017
314682c
[9.0][IMP] rma: add constrains
LoisRForgeFlow Oct 19, 2017
b521584
[9.0][FIX] wizards need to specify partner.
LoisRForgeFlow Oct 19, 2017
6fe09c7
[9.0][FIX] rma_account: refund wizard
LoisRForgeFlow Nov 10, 2017
33fdb14
[FIX] allow child partners too
LoisRForgeFlow Nov 13, 2017
f83add7
[MIG]rma account v10
AaronHForgeFlow Dec 19, 2017
fba66d2
[IMP] Improved Unit Test Case and Fixed Travis
nikul-serpentcs Nov 10, 2017
8e458e9
[FIX]various fixes
AaronHForgeFlow Jan 2, 2018
7e9ff70
[MIG] Migrated UT & Fixed Travis
nikul-serpentcs Jan 5, 2018
e48d91c
[MIG] Migrate configuration and cleanup
max3903 Feb 9, 2018
443d2cb
[9.0][IMP] rma_sale and rma_account: consider product when filtering …
LoisRForgeFlow May 23, 2018
470e4b1
[9.0] rma_account:
LoisRForgeFlow May 17, 2018
81cae6a
[ADD] rma_account: add rma menu on the accounting app
LoisRForgeFlow May 24, 2018
1a3555c
fixup! rma account menus
LoisRForgeFlow May 25, 2018
3436c28
[IMP]add rma lines to invoices as it is done with PO
AaronHForgeFlow May 25, 2018
505e754
[IMP]nicer name_get in the invoice
AaronHForgeFlow May 31, 2018
a83156c
[11.0] MIG: rma_account
Feb 9, 2018
038f7ef
[FIX] Add read access to invoice
max3903 Jun 26, 2018
91d8a49
Update __manifest__.py
max3903 Jul 24, 2018
545f1f9
[FIX] navigation button issue TypeError: unhashable type: 'list'
Jul 25, 2018
959cee6
[FIX] issue of 'Add from RMA Line' in Customer/Vendor invoice
Jul 25, 2018
0e29771
[FIX] issue of filters
Jul 25, 2018
b7b3787
[FIX] issue of name_get when pull down list from 'Originating Invoice…
Jul 25, 2018
fd1fe95
[9.0][REW] rma_account: complete rework of tests
LoisRForgeFlow May 17, 2018
3be50de
[FIX]refund policy
AaronHForgeFlow Jul 30, 2018
b104dbe
[FIX]rma account operations is data
AaronHForgeFlow Aug 21, 2018
776a3ae
[FIX]currency_id was not filled
AaronHForgeFlow Oct 4, 2018
406cad5
[12.0][MIG] Migrate rma_account module to v12.0
AdriaGForgeFlow Nov 19, 2018
0499323
rma_account: Fix uom res.groups
grindtildeath Mar 12, 2019
0a5ba4a
rma_account: Fix res.groups on discount
grindtildeath Mar 12, 2019
cf61321
rma_account: Fix test opening invoice before validating
grindtildeath Mar 12, 2019
dfe2a09
Proxy fields defaults with lambda to allow inheritance
grindtildeath Mar 18, 2019
30f65d9
Use strings on fields compute to allow inheritance
grindtildeath Mar 18, 2019
ed59676
[SET] Correct website URL for RMA modules
May 24, 2019
9f892b5
[FIX] rma_account: The model rma.refund has no _description
max3903 Aug 1, 2019
607d771
[FIX]refund policy consistency rma vs operation
AaronHForgeFlow Jul 24, 2019
4162f9a
[MIG]account_move_line_rma_order_line to v12
AaronHForgeFlow Aug 5, 2019
a0ea7dd
[FIX]filter by partner
AaronHForgeFlow Sep 18, 2019
38b3652
[FIX]remove autoinstall for rma_account, rma_sale and rma_purchase mo…
AaronHForgeFlow Oct 29, 2019
e4eadd8
[FIX] default_gets: avoid using shadowname 'fields'
MiquelRForgeFlow Nov 29, 2019
340257e
[IMP] : black, isort
AaronHForgeFlow Jan 22, 2020
b4bcd7f
[UPT]rebranding
AaronHForgeFlow Jan 22, 2020
92d9f5f
[MIG]rma_account to v13
AaronHForgeFlow Jan 22, 2020
b4e7ad1
[FIX]rma_account refund creation
AaronHForgeFlow Feb 14, 2020
4376f2c
[FIX]rma_account test + adding from existing invoice
AaronHForgeFlow Feb 14, 2020
97f1217
[FIX]rma_account. currency method.
AaronHForgeFlow Mar 9, 2020
e2244b6
[FIX]rma_account call new currency convert method
AaronHForgeFlow Mar 19, 2020
db5bcd7
[IMP] Update pre-commit lints according with OCA ones
HviorForgeFlow May 29, 2020
d85281b
[IMP] rma_account: black, isort, prettier
MateuGForgeFlow Dec 21, 2020
4aa4197
[MIG] rma_account: Migration to 14.0
MateuGForgeFlow Dec 21, 2020
b57930a
Update rma_account/views/account_move_view.xml
MateuGForgeFlow Jan 20, 2021
dcc4856
[MIG] rma_repair: Migration to 14.0 - account fix
MateuGForgeFlow Jan 28, 2021
b54705e
[IMP] rma_account: adapt to simplification on rma.line form view.
LoisRForgeFlow Mar 26, 2021
a79cc74
[14.0][FIX] rma_account: incorrect "To Refund" filter.
LoisRForgeFlow Mar 29, 2021
ff1a645
[14.0][MIG] rma*: ir.actions.act_window has different access
LoisRForgeFlow Apr 16, 2021
1930b80
[IMP] rma_account: add default journal
MateuGForgeFlow Jul 30, 2021
c0bca84
[14.0][FIX] rma_account: change account in credit notes
MateuGForgeFlow Aug 17, 2021
bb880b9
[rma_account][imp] do not force the refund invoice number to be the R…
JordiBForgeFlow Sep 2, 2021
1db239d
[rma_account][imp] allow to change the refund policy even when the rm…
JordiBForgeFlow Sep 2, 2021
c1ad0d4
Fix Pre-commit Websites
MateuGForgeFlow Oct 6, 2021
3717ce0
[IMP]rma_account: Change permissions to create refunds
AlvarTB Dec 3, 2021
78559d4
[rma_account][imp] make features available to the billing user instead
JordiBForgeFlow Dec 16, 2021
42e853f
[MIG] rma_account: Migration to 15.0
JasminSForgeFlow Jan 7, 2022
9a57d1a
[14.0][IMP] rma_account: make refund policy editable in approved rmas
AaronHForgeFlow Jan 19, 2022
3e2c0a1
[IMP] COPIER UPDATE: black, isort, prettier
AaronHForgeFlow Apr 22, 2022
f48e298
[IMP] rma: Refactor all rma modules in order to consider using the co…
JordiBForgeFlow Mar 2, 2022
07cce71
[FIX] rma_account: maintain refund_line_id
JordiBForgeFlow Mar 2, 2022
7bfaa21
[15.0][IMP] Tests for stock valuation
AaronHForgeFlow Mar 4, 2022
0fb10d4
[IMP]rma_account: include features from account_move_line_rma_order_l…
AaronHForgeFlow May 13, 2022
14ee002
[FIX] rma_account: refund policy not being updated from rma group
LoisRForgeFlow May 13, 2022
81c380a
Hide smart button when empty
florian-dacosta Jun 8, 2022
a427d80
[IMP] Make rma order view cleaner for user
florian-dacosta Jul 1, 2022
492a764
[15.0][FIX] rma_account: fixup of procurement
DavidJForgeFlow Jul 11, 2022
a622c0b
[FIX] get price unit with all related layers on sale moves
ChrisOForgeFlow Oct 4, 2022
3741849
[IMP] fp-303: add changes from 14.0
Nov 8, 2022
4fc6458
[FIX] include anglo-saxon price unit calculation in refunds.
JordiBForgeFlow Nov 21, 2022
9f1b57f
fix pylint
JordiBForgeFlow Nov 24, 2022
5b6225b
[FIX] include anglo-saxon price unit calculation in refunds.
JordiBForgeFlow Nov 21, 2022
8efed1f
[IMP] centralize the logic to get the correct cost of the RMA.
JordiBForgeFlow Nov 23, 2022
bcfa5cd
[FIX] rma_account: try to auto-reconcile interim account
JordiBForgeFlow Nov 27, 2022
5f0a540
[IMP] calculate refund unit price
JordiBForgeFlow Nov 29, 2022
3146119
[FIX] rma_account: Ensure that configuration on the operation is applied
LoisRForgeFlow Dec 28, 2022
c3d0af8
[IMP] rma_account: adapt to changes in supplier rma group form view.
LoisRForgeFlow Jan 2, 2023
a6a26bc
[14.0][FIX] rma_account: reconcile GDNI when receiving but refund is …
AaronHForgeFlow Jan 4, 2023
f67dfd5
[IMP] rma_account: pre-commit, context overridden using dict. Better …
AaronHForgeFlow Feb 8, 2023
0c4a850
[MIG] rma_account: Migration to 16.0
DavidJForgeFlow Feb 22, 2023
685d690
[IMP] rma_account: add index in account.move.line to field 'rma_line_id'
JordiBForgeFlow Feb 27, 2023
98fdf50
[IMP] rma_account: change account_move_line_id domain to make search …
mariadforgeflow Feb 28, 2023
ae5f0bb
[FIX]rma_account: inherit account.move.line in one file only
AaronHForgeFlow Oct 27, 2023
9cbe7b6
[FIX]rma_account: avoid duplicated field string
AaronHForgeFlow Oct 31, 2023
547e4b3
[IMP] rma_account: black, isort, prettier
AaronHForgeFlow May 6, 2024
0a1ad9f
[MIG] rma_account: Migration to v17
Nikul-OSI May 6, 2024
e41ce78
[FIX] rma_account: name search not getting invoice line
AaronHForgeFlow May 6, 2024
96d1d41
[FIX] rma_account: default refund journal should respect rma line com…
AaronHForgeFlow May 8, 2024
5bfabf2
[16.0][FIX] rma_account: fiscal_position_id is a computed field
AlexPForgeFlow Aug 19, 2024
590788a
[16.0][IMP] rma_account: consider rma delivery address when creating …
AlexPForgeFlow Aug 20, 2024
88d09a0
[16.0][IMP] rma_account & rma_sale: fix delivery and invoice addresses
AlexPForgeFlow Aug 20, 2024
21d35e3
[MIG] rma_account: Migration to 18.0
JasminSForgeFlow Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions rma_account/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:alt: License LGPL-3

===========
RMA Account
===========

This module integrates Return Merchandise Authorizations (RMA) with invoices,
allowing to:

#. Create complete RMA's using existing invoices as a reference.
#. Create refunds from a RMA.

Usage
=====

RMA are accessible though Inventory menu. There's four menus, divided by type.
Users can access to the list of RMA or RMA lines.

Create an RMA:

#. Select a partner. Fill the rma lines by selecting an invoice.
#. Request approval and approve.
#. Click on RMA Lines button.
#. Click on more and select an option: "Receive products", "Create Delivery
Order, Create Refund".
#. Go back to the RMA. Set the RMA to done if not further action is required.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/ForgeFlow/stock-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.

Credits
=======

Contributors
------------

* Jordi Ballester Alomar <[email protected]>
* Aaron Henriquez <[email protected]>
* Lois Rilo <[email protected]>
* Bhavesh Odedra <[email protected]>
* Akim Juillerat <[email protected]>

Maintainer
----------

This module is maintained by ForgeFlow.
5 changes: 5 additions & 0 deletions rma_account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2017 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from . import models
from . import wizards
25 changes: 25 additions & 0 deletions rma_account/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

{
"name": "RMA Account",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"category": "RMA",
"summary": "Integrates RMA with Invoice Processing",
"author": "ForgeFlow",
"website": "https://github.com/ForgeFlow",
"depends": ["stock_account", "rma"],
"data": [
"security/ir.model.access.csv",
"data/rma_operation.xml",
"views/rma_order_view.xml",
"views/rma_operation_view.xml",
"views/rma_order_line_view.xml",
"views/account_move_view.xml",
"views/rma_account_menu.xml",
"wizards/rma_add_account_move.xml",
"wizards/rma_refund.xml",
],
"installable": True,
}
42 changes: 42 additions & 0 deletions rma_account/data/rma_operation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" ?>
<odoo noupdate="1">

<record id="rma.rma_operation_customer_replace" model="rma.operation">
<field name="refund_policy">no</field>
</record>

<record id="rma.rma_operation_supplier_replace" model="rma.operation">
<field name="refund_policy">no</field>
</record>

<record id="rma_operation_customer_refund" model="rma.operation">
<field name="name">Refund after receive</field>
<field name="code">RF-C</field>
<field name="refund_policy">received</field>
<field name="receipt_policy">ordered</field>
<field name="delivery_policy">no</field>
<field name="type">customer</field>
<field name="in_route_id" ref="rma.route_rma_customer" />
<field name="out_route_id" ref="rma.route_rma_customer" />
</record>

<record id="rma_operation_supplier_refund" model="rma.operation">
<field name="name">Refund after deliver</field>
<field name="code">RF-S</field>
<field name="refund_policy">ordered</field>
<field name="receipt_policy">no</field>
<field name="delivery_policy">ordered</field>
<field name="type">supplier</field>
<field name="in_route_id" ref="rma.route_rma_supplier" />
<field name="out_route_id" ref="rma.route_rma_supplier" />
</record>

<record id="rma.rma_operation_ds_replace" model="rma.operation">
<field name="refund_policy">no</field>
</record>

<record id="rma.rma_operation_ds_replace_supplier" model="rma.operation">
<field name="refund_policy">no</field>
</record>

</odoo>
8 changes: 8 additions & 0 deletions rma_account/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from . import rma_order
from . import rma_order_line
from . import rma_operation
from . import account_move
from . import account_move_line
from . import procurement
from . import stock_move
from . import stock_valuation_layer
147 changes: 147 additions & 0 deletions rma_account/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Copyright 2017-22 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import api, fields, models
from odoo.tools.float_utils import float_compare


class AccountMove(models.Model):
_inherit = "account.move"

@api.depends("line_ids.rma_line_ids")
def _compute_used_in_rma_count(self):
for inv in self:
rmas = inv.mapped("line_ids.rma_line_ids")
inv.used_in_rma_count = len(rmas)

@api.depends("line_ids.rma_line_id")
def _compute_rma_count(self):
for inv in self:
rmas = inv.mapped("line_ids.rma_line_id")
inv.rma_count = len(rmas)

def _prepare_invoice_line_from_rma_line(self, rma_line):
sequence = max(self.line_ids.mapped("sequence")) + 1 if self.line_ids else 10
qty = rma_line.qty_to_refund
if float_compare(qty, 0.0, precision_rounding=rma_line.uom_id.rounding) <= 0:
qty = 0.0
data = {
"move_id": self.id,
"product_uom_id": rma_line.uom_id.id,
"product_id": rma_line.product_id.id,
"price_unit": rma_line.company_id.currency_id._convert(
rma_line._get_price_unit(),
self.currency_id,
self.company_id,
self.date,
round=False,
),
"quantity": qty,
"discount": 0.0,
"rma_line_id": rma_line.id,
"sequence": sequence + 1,
}
return data

def _post_process_invoice_line_from_rma_line(self, new_line, rma_line):
new_line.rma_line_id = rma_line
new_line.name = f"{self.add_rma_line_id.name}: {new_line.name}"
new_line.account_id = new_line.account_id
return True

@api.onchange("add_rma_line_id")
def onchange_add_rma_line_id(self):
if not self.add_rma_line_id:
return {}
if not self.partner_id:
self.partner_id = self.add_rma_line_id.partner_id.id

new_line = self.env["account.move.line"]
if self.add_rma_line_id not in (self.line_ids.mapped("rma_line_id")):
data = self._prepare_invoice_line_from_rma_line(self.add_rma_line_id)
new_line = new_line.new(data)
self._post_process_invoice_line_from_rma_line(
new_line, self.add_rma_line_id
)
# Compute invoice_origin.
origins = set(self.line_ids.mapped("rma_line_id.name"))
self.invoice_origin = ",".join(list(origins))
self.add_rma_line_id = False

rma_count = fields.Integer(compute="_compute_rma_count", string="# of RMA")
used_in_rma_count = fields.Integer(
compute="_compute_used_in_rma_count", string="# of Used in RMA"
)

add_rma_line_id = fields.Many2one(
comodel_name="rma.order.line",
string="Add from RMA line",
ondelete="set null",
help="Create a refund in based on an existing rma_line",
)

def action_view_used_in_rma(self):
rmas = self.mapped("line_ids.rma_line_ids")
return self._prepare_action_view_rma(rmas)

def action_view_rma(self):
rmas = self.mapped("line_ids.rma_line_id")
return self._prepare_action_view_rma(rmas)

def _prepare_action_view_rma(self, rmas):
if self.move_type in ["in_invoice", "in_refund"]:
action = self.env.ref("rma.action_rma_supplier_lines")
form_view = self.env.ref("rma.view_rma_line_supplier_form", False)
else:
action = self.env.ref("rma.action_rma_customer_lines")
form_view = self.env.ref("rma.view_rma_line_form", False)
result = action.sudo().read()[0]
rma_ids = rmas.ids
# choose the view_mode accordingly
if not rma_ids:
result["domain"] = [("id", "in", [])]
elif len(rma_ids) > 1:
result["domain"] = [("id", "in", rma_ids)]
else:
res = form_view
result["views"] = [(res and res.id or False, "form")]
result["res_id"] = rma_ids and rma_ids[0] or False
return result

def _stock_account_prepare_anglo_saxon_out_lines_vals(self):
product_model = self.env["product.product"]
res = super()._stock_account_prepare_anglo_saxon_out_lines_vals()
for line in res:
if line.get("product_id", False):
product = product_model.browse(line.get("product_id", False))
if (
line.get("account_id")
!= product.categ_id.property_stock_valuation_account_id.id
):
current_move = self.browse(line.get("move_id", False))
current_rma = current_move.invoice_line_ids.filtered(
lambda x, product=product: x.rma_line_id
and x.product_id.id == product.id
).mapped("rma_line_id")
if len(current_rma) == 1:
line.update({"rma_line_id": current_rma.id})
elif len(current_rma) > 1:
find_with_label_rma = current_rma.filtered(
lambda x, line=line: x.name == line.get("name")
)
if len(find_with_label_rma) == 1:
line.update({"rma_line_id": find_with_label_rma.id})
return res

def _stock_account_get_last_step_stock_moves(self):
rslt = super()._stock_account_get_last_step_stock_moves()
for invoice in self.filtered(lambda x: x.move_type == "out_invoice"):
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
lambda x: x.state == "done" and x.location_dest_id.usage == "customer"
)
for invoice in self.filtered(lambda x: x.move_type == "out_refund"):
# Add refunds generated from the RMA
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
lambda x: x.state == "done" and x.location_id.usage == "customer"
)
return rslt
Loading
Loading