[ADD]rma_sale_analytic

This commit is contained in:
aheficent
2018-01-03 15:13:16 +01:00
committed by Aaron ForgeFlow
parent bcacdc357f
commit 39be5588cf
8 changed files with 115 additions and 0 deletions

View 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.

View 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

View 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,
}

View 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

View 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"))

View 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

View 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

View 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