Merge lp:~vauxoo/addons-vauxoo/7.0-account_analytic_required_invoice_line-dev_luis into lp:addons-vauxoo/7.0

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 896
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-account_analytic_required_invoice_line-dev_luis
Merge into: lp:addons-vauxoo/7.0
Diff against target: 85 lines (+64/-1)
2 files modified
account_analytic_required/account.py (+18/-1)
account_analytic_required/account_view.xml (+46/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-account_analytic_required_invoice_line-dev_luis
Reviewer Review Type Date Requested Status
Luis Torres - http://www.vauxoo.com Needs Resubmitting
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com Needs Fixing
hbto [Vauxoo] http://www.vauxoo.com Approve
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+191859@code.launchpad.net

Description of the change

Se agrego una validación para que cuando la cuenta colocada en las lineas de la factura tienen activado el campo que indica que requiere cuenta analitica, esta sea requerida.

To post a comment you must log in.
876. By Luis Torres - http://www.vauxoo.com

[IMP][account_analytic_required]Added onchange on invoices of supplier, and added super in function

Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

Revisado el codigo no he hecho prueba del modulo, me parece bien,

una sugerencia,

+ res = super(account_invoice_line, self).onchange_account_id(cr, uid, ids, product_id, partner_id, inv_type, fposition_id, account_id)

pasa tambien el context en el super,

Saludos.

review: Approve
877. By Luis Torres - http://www.vauxoo.com

[REF][account_analytic_required]Added context in super

Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) wrote :

Probanto esta propesta de merge me encuentro con el siguiente error:

http://awesomescreenshot.com/0d81uxzt27

review: Needs Fixing
Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) wrote :

Por muy simple que sea el cambio se debe realizar su prueba, para confirmar que todo funcione bien

878. By Luis Torres - http://www.vauxoo.com

[FIX][account_analytic_required]Removed context in function

Revision history for this message
Luis Torres - http://www.vauxoo.com (luis-cleto-) wrote :

Se elimino el context de la función

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_analytic_required/account.py'
2--- account_analytic_required/account.py 2013-07-22 16:24:09 +0000
3+++ account_analytic_required/account.py 2013-10-23 19:58:53 +0000
4@@ -35,7 +35,24 @@
5 'this field is active, the journal items that used this account '\
6 'should have an analytic account'),
7 }
8-
9+
10+class account_invoice_line(osv.Model):
11+ _inherit = 'account.invoice.line'
12+
13+ _columns = {
14+ 'analytic_required': fields.boolean('Analytic Required', help='If this field is active, '\
15+ 'be required fill the field "account analytic"'),
16+ }
17+
18+ def onchange_account_id(self, cr, uid, ids, product_id=False, partner_id=False,\
19+ inv_type=False, fposition_id=False, account_id=False):
20+ res = super(account_invoice_line, self).onchange_account_id(cr, uid, ids, product_id,
21+ partner_id, inv_type, fposition_id, account_id)
22+ account_obj = self.pool.get('account.account')
23+ if account_id:
24+ analyt_req = account_obj.browse(cr, uid, account_id).analytic_required
25+ res['value'].update({'analytic_required': analyt_req})
26+ return res
27
28 class account_move(osv.Model):
29 _inherit = 'account.move'
30
31=== modified file 'account_analytic_required/account_view.xml'
32--- account_analytic_required/account_view.xml 2013-04-19 22:53:57 +0000
33+++ account_analytic_required/account_view.xml 2013-10-23 19:58:53 +0000
34@@ -11,5 +11,51 @@
35 </xpath>
36 </field>
37 </record>
38+
39+ <record model="ir.ui.view" id="view_account_invoice_inherit_analytic_required_form">
40+ <field name="name">view.account.invoice.inherit.analytic.required.form</field>
41+ <field name="model">account.invoice</field>
42+ <field name="inherit_id" ref="account.invoice_form"/>
43+ <field name="arch" type="xml">
44+ <xpath
45+ expr="//field[@name='invoice_line']/tree[@string='Invoice Lines']/field[@name='account_analytic_id']"
46+ position="attributes">
47+ <attribute name="attrs">{'required': [('analytic_required', '=', True),]}</attribute>
48+ </xpath>
49+ <xpath
50+ expr="//field[@name='invoice_line']/tree[@string='Invoice Lines']/field[@name='account_id']"
51+ position="attributes">
52+ <attribute name="on_change">onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position, account_id)</attribute>
53+ </xpath>
54+ <xpath
55+ expr="//field[@name='invoice_line']/tree[@string='Invoice Lines']/field[@name='account_analytic_id']"
56+ position="after">
57+ <field name="analytic_required" invisible="1"/>
58+ </xpath>
59+ </field>
60+ </record>
61+
62+ <record model="ir.ui.view" id="view_account_invoice_supplier_inherit_analytic_required_form">
63+ <field name="name">view.account.invoice.supplier.inherit.analytic.required.form</field>
64+ <field name="model">account.invoice</field>
65+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
66+ <field name="arch" type="xml">
67+ <xpath
68+ expr="//field[@name='invoice_line']/tree[@string='Invoice lines']/field[@name='account_analytic_id']"
69+ position="attributes">
70+ <attribute name="attrs">{'required': [('analytic_required', '=', True),]}</attribute>
71+ </xpath>
72+ <xpath
73+ expr="//field[@name='invoice_line']/tree[@string='Invoice lines']/field[@name='account_id']"
74+ position="attributes">
75+ <attribute name="on_change">onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position, account_id)</attribute>
76+ </xpath>
77+ <xpath
78+ expr="//field[@name='invoice_line']/tree[@string='Invoice lines']/field[@name='account_analytic_id']"
79+ position="after">
80+ <field name="analytic_required" invisible="1"/>
81+ </xpath>
82+ </field>
83+ </record>
84 </data>
85 </openerp>