[ADD]rma_purchase_analytic

[FIX]various
This commit is contained in:
aheficent
2018-01-03 15:20:45 +01:00
committed by Aarón Henríquez
parent 34d76ee570
commit d1de414235
18 changed files with 113 additions and 14 deletions

View File

@@ -2,4 +2,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
from . import tests
from . import wizards

View File

@@ -3,9 +3,10 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Analytic Account in RMA",
"name": "Analytic Account in RMA account",
"version": "10.0.1.0.0",
"author": "Eficent",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
"category": "Analytic",

View File

@@ -8,7 +8,6 @@ from odoo import _, api, exceptions, models
class AccountInvocieLine(models.Model):
_inherit = "account.invoice.line"
@api.constrains('analytic_account_id')
def check_analytic(self):
for inv in self:

View File

@@ -10,7 +10,7 @@ class RmaRefund(models.TransientModel):
@api.model
def prepare_refund_line(self, item, refund):
refund_line = super(RmaAddInvoice, self).prepare_refund_line(
refund_line = super(RmaRefund, self).prepare_refund_line(
item, refund)
refund_line.update(
analytic_account_id=item.line_id.analytic_account_id.id)

View File

@@ -2,4 +2,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
from . import tests
from . import wizards

View File

@@ -5,7 +5,8 @@
{
"name": "Analytic Account in RMA",
"version": "10.0.1.0.0",
"author": "Eficent",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
"category": "Analytic",

View File

@@ -2,7 +2,7 @@
# © 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, fields, models
from odoo import fields, models
class RmaOrderLine(models.Model):

View File

@@ -0,0 +1,32 @@
.. 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 PO line.
* 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 wizards

View File

@@ -0,0 +1,17 @@
# -*- 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 purchase",
"version": "10.0.1.0.0",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
"category": "Analytic",
"depends": ["rma_account", "rma_analytic", "purchase_analytic"],
"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 purchase_order_line

View File

@@ -0,0 +1,18 @@
# -*- 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 PurchaseOrderLine(models.Model):
_inherit = "purchase.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 PO line it's not the same"
" as in the rma line"))

View File

@@ -0,0 +1,5 @@
# -*- 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_purchase

View File

@@ -0,0 +1,15 @@
# -*- 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 RmaAddPurchase(models.TransientModel):
_inherit = 'rma_add_purchase'
@api.model
def _prepare_rma_line_from_po_line(self, line):
data = super(RmaAddPurchase, self)._prepare_rma_line_from_po_line(line)
data.update(analytic_account_id=line.analytic_account_id.id)
return data

View File

@@ -2,4 +2,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
from . import tests
from . import wizards

View File

@@ -3,13 +3,14 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Analytic Account in RMA",
"name": "Analytic Account in RMA sale",
"version": "10.0.1.0.0",
"author": "Eficent",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
"category": "Analytic",
"depends": ["rma_account", "rma_analytic", "stock_analytic_account"],
"depends": ["rma_account", "rma_analytic"],
"data": [
],
'installable': True,

View File

@@ -11,7 +11,8 @@ class SaleOrderLine(models.Model):
@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:
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

@@ -10,7 +10,7 @@ class RmaAddSale(models.TransientModel):
@api.model
def _prepare_rma_line_from_sale_order_line(self, line):
data = super(RmaAddInvoice, self).\
data = super(RmaAddSale, self).\
_prepare_rma_line_from_sale_order_line(line)
data.update(analytic_account_id=line.analytic_account_id.id)
return data