mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[ADD]rma_sale_analytic
This commit is contained in:
committed by
Aaron ForgeFlow
parent
bcacdc357f
commit
39be5588cf
34
rma_sale_analytic/README.rst
Normal file
34
rma_sale_analytic/README.rst
Normal file
@@ -0,0 +1,34 @@
|
||||
.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg
|
||||
:target: https://www.gnu.org/licenses/lgpl.html
|
||||
:alt: License: LGPL-3
|
||||
|
||||
==========================
|
||||
RMA with Analytic Accounts
|
||||
==========================
|
||||
|
||||
This module introduces the following features:
|
||||
|
||||
* Adds the analytic account to the RMA order lines from the origin sale.
|
||||
|
||||
* Propagates the analytic account to the SO created
|
||||
|
||||
* Introduce rules to ensure consistency
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
* Add the analytic information in the rma line or let the system fill it
|
||||
from origin
|
||||
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Aaron Henriquez <ahenriquez@eficent.com>
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by Eficent.
|
||||
5
rma_sale_analytic/__init__.py
Normal file
5
rma_sale_analytic/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import models
|
||||
from . import tests
|
||||
16
rma_sale_analytic/__manifest__.py
Normal file
16
rma_sale_analytic/__manifest__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
{
|
||||
"name": "Analytic Account in RMA",
|
||||
"version": "10.0.1.0.0",
|
||||
"author": "Eficent",
|
||||
"license": "LGPL-3",
|
||||
"website": "http://www.eficent.com",
|
||||
"category": "Analytic",
|
||||
"depends": ["rma_account", "rma_analytic", "stock_analytic_account"],
|
||||
"data": [
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
4
rma_sale_analytic/models/__init__.py
Normal file
4
rma_sale_analytic/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import sale_order_line
|
||||
17
rma_sale_analytic/models/sale_order_line.py
Normal file
17
rma_sale_analytic/models/sale_order_line.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import _, api, exceptions, models
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = "sale.order.line"
|
||||
|
||||
@api.constrains('analytic_account_id')
|
||||
def check_analytic(self):
|
||||
for line in self:
|
||||
if line.analytic_account_id != line.rma_line_id.analytic_account_id:
|
||||
raise exceptions.ValidationError(
|
||||
_("The analytic account in the sale line it's not the same"
|
||||
" as in the rma line"))
|
||||
6
rma_sale_analytic/wizards/__init__.py
Normal file
6
rma_sale_analytic/wizards/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from . import rma_add_sale
|
||||
from . import rma_order_line_make_sale_order
|
||||
16
rma_sale_analytic/wizards/rma_add_sale.py
Normal file
16
rma_sale_analytic/wizards/rma_add_sale.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class RmaAddSale(models.TransientModel):
|
||||
_inherit = 'rma_add_sale'
|
||||
|
||||
@api.model
|
||||
def _prepare_rma_line_from_sale_order_line(self, line):
|
||||
data = super(RmaAddInvoice, self).\
|
||||
_prepare_rma_line_from_sale_order_line(line)
|
||||
data.update(analytic_account_id=line.analytic_account_id.id)
|
||||
return data
|
||||
17
rma_sale_analytic/wizards/rma_order_line_make_sale_order.py
Normal file
17
rma_sale_analytic/wizards/rma_order_line_make_sale_order.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from odoo import models, api
|
||||
|
||||
|
||||
class RmaLineMakeSaleOrder(models.TransientModel):
|
||||
_inherit = "rma.order.line.make.sale.order"
|
||||
|
||||
@api.model
|
||||
def _prepare_sale_order_line(self, so, item):
|
||||
sale_line = super(
|
||||
RmaLineMakeSaleOrder, self)._prepare_sale_order_line(so, item)
|
||||
sale_line.update(
|
||||
analytic_account_id=item.line_id.analytic_account_id.id)
|
||||
return sale_line
|
||||
Reference in New Issue
Block a user