[FIX] Fixed UT & Travis

This commit is contained in:
Nikul Chaudhary
2018-01-10 13:54:55 +01:00
committed by Aaron ForgeFlow
parent 0aae76a261
commit bf0c05d721
6 changed files with 27 additions and 22 deletions

View File

@@ -26,9 +26,10 @@ Contributors
------------
* Aaron Henriquez <ahenriquez@eficent.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
Maintainer
----------
This module is maintained by Eficent.
This module is maintained by Eficent.

View File

@@ -10,7 +10,8 @@
"license": "LGPL-3",
"website": "http://www.eficent.com",
"category": "Analytic",
"depends": ["rma", "analytic", "procurement_analytic"],
"depends": ["rma", "analytic", "procurement_analytic",
'stock_analytic_account'],
"data": [
"views/rma_order_line_view.xml"
],

View File

@@ -9,11 +9,11 @@ class ProcurementOrder(models.Model):
_inherit = "procurement.order"
@api.constrains('analytic_account_id')
def check_analytic(self):
for order in self:
if order.analytic_account_id != order.rma_line_id.analytic_account_id:
raise exceptions.ValidationError(
_("The analytic account in the procurement it's not the same"
" as in the rma line"))
@api.constrains('analytic_account_id')
def check_analytic(self):
for order in self:
if (order.analytic_account_id !=
order.rma_line_id.analytic_account_id):
raise exceptions.ValidationError(
_("The analytic account in the procurement it's not the "
"same as in the rma line"))

View File

@@ -10,6 +10,6 @@ class RmaOrderLine(models.Model):
_inherit = "rma.order.line"
analytic_account_id = fields.Many2one(
comodel_name='account.analytic',
comodel_name='account.analytic.account',
string='Analytic Account',
)

View File

@@ -1,3 +1,4 @@
# -*- 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).
from . import test_rma_analytic

View File

@@ -2,7 +2,7 @@
# © 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from . import test_rma
from odoo.addons.rma.tests import test_rma
class TestRmaAnalytic(test_rma.TestRma):
@@ -11,20 +11,22 @@ class TestRmaAnalytic(test_rma.TestRma):
super(TestRmaAnalytic, self).setUp()
products2move = [(self.product_1, 3), (self.product_2, 5),
(self.product_3, 2)]
self.rma_id = self._create_rma_from_move(
self.rma_ana_id = self._create_rma_from_move(
products2move, 'supplier', self.env.ref('base.res_partner_1'),
dropship=False)
self.analytic_1 = self.env['account.analytic.account'].create({
def _prepare_move(self, product, qty, src, dest, picking_in):
res = super(TestRmaAnalytic, self)._prepare_move(
product, qty, src, dest, picking_in)
analytic_1 = self.env['account.analytic.account'].create({
'name': 'Test account #1',
})
def _prepare_move(self, product, qty, src, dest):
res = super(TestRmaAnalytic, self)._prepare_move(
product, qty, src, dest)
res.update(analytic_account_id=self.analytic_1.id)
res.update({'analytic_account_id': analytic_1.id})
return res
def test_analytic(self):
for line in self.rma_id.line_ids:
self.assertEqual(line.analytic_account_id, self.analytic_1,
"the analytic account is not propagated")
for line in self.rma_ana_id.rma_line_ids:
for move in line.move_ids:
self.assertEqual(
line.analytic_account_id, move.analytic_account_id,
"the analytic account is not propagated")