[MIG] account_move_line_stock_info to v10

This commit is contained in:
lreficent
2017-03-16 11:52:48 +01:00
committed by ps-tubtim
parent 494aee5c9c
commit fb87f1e8fa
9 changed files with 63 additions and 73 deletions

View File

@@ -8,7 +8,6 @@ Account Move Line Stock Move
This module adds the stock move to the account move lines that it generates.
Usage
=====
@@ -21,8 +20,7 @@ Reports > Stock moves'.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/153/8.0
:target: https://runbot.odoo-community.org/runbot/153/10.0
Bug Tracker
===========
@@ -40,6 +38,7 @@ Credits
Contributors
------------
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>
Maintainer
----------

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Move Line Stock Move",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"depends": [
"stock_account"
],

View File

@@ -3,5 +3,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_move_line
from . import stock_quant
from . import stock_move

View File

@@ -2,11 +2,12 @@
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
from odoo import fields, models
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
stock_move_id = fields.Many2one(comodel_name='stock.move',
string='Stock Move', copy=False)
stock_move_id = fields.Many2one(
comodel_name='stock.move', string='Stock Move', copy=False,
index=True)

View File

@@ -2,7 +2,7 @@
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
from odoo import api, fields, models
class StockMove(models.Model):
@@ -11,3 +11,12 @@ class StockMove(models.Model):
account_move_line_ids = fields.One2many(
comodel_name='account.move.line', inverse_name='stock_move_id',
copy=False)
@api.model
def _prepare_account_move_line(self, qty, cost,
credit_account_id, debit_account_id):
res = super(StockMove, self)._prepare_account_move_line(
qty, cost, credit_account_id, debit_account_id)
for line in res:
line[2]['stock_move_id'] = self.id
return res

View File

@@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
class StockQuant(models.Model):
_inherit = 'stock.quant'
@api.model
def _prepare_account_move_line(self, move, qty, cost,
credit_account_id, debit_account_id):
res = super(StockQuant, self)._prepare_account_move_line(
move, qty, cost, credit_account_id, debit_account_id)
for line in res:
line[2]['stock_move_id'] = move.id
return res

View File

@@ -2,10 +2,10 @@
# © 2015 Eficent Business and IT Consulting Services S.L. (www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from odoo.tests.common import TransactionCase
class TestAccountMoveLineStockInfo(common.TransactionCase):
class TestAccountMoveLineStockInfo(TransactionCase):
def setUp(self):
super(TestAccountMoveLineStockInfo, self).setUp()

View File

@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="stock_move_id"/>
</field>
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="stock_move_id"/>
</field>
</record>
</field>
</record>
<record id="view_move_line_form2" model="ir.ui.view">
<field name="name">account.move.line.form2</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form2"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="stock_move_id"/>
</field>
<record id="view_move_line_form2" model="ir.ui.view">
<field name="name">account.move.line.form2</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form2"/>
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="stock_move_id"/>
</field>
</record>
</field>
</record>
</odoo>

View File

@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<group name="moved_quants_grp" position="after">
<group name="account_move_lines_grp"
string="Journal Items" colspan="4">
<field name="account_move_line_ids" readonly="1"
nolabel="1"/>
</group>
<record id="view_move_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<group name="moved_quants_grp" position="after">
<group name="account_move_lines_grp"
string="Journal Items" colspan="4">
<field name="account_move_line_ids" readonly="1"
nolabel="1"/>
</group>
</field>
</record>
</group>
</field>
</record>
<record id="view_move_picking_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_form"/>
<field name="arch" type="xml">
<group name="moved_quants_grp" position="after">
<group name="account_move_lines_grp"
string="Journal Items" colspan="4">
<field name="account_move_line_ids" readonly="1"
nolabel="1"/>
</group>
<record id="view_move_picking_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_form"/>
<field name="arch" type="xml">
<group name="moved_quants_grp" position="after">
<group name="account_move_lines_grp"
string="Journal Items" colspan="4">
<field name="account_move_line_ids" readonly="1"
nolabel="1"/>
</group>
</field>
</record>
</group>
</field>
</record>
</odoo>