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

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 980
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-account_no_check_default_reconcile-dev_luis
Merge into: lp:addons-vauxoo/7.0
Diff against target: 191 lines (+129/-21)
3 files modified
account_voucher_no_check_default/__openerp__.py (+2/-1)
account_voucher_no_check_default/account_voucher.py (+107/-12)
account_voucher_no_check_default/view/voucher_payment_receipt_view.xml (+20/-8)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-account_no_check_default_reconcile-dev_luis
Reviewer Review Type Date Requested Status
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com Needs Fixing
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+196039@code.launchpad.net

Description of the change

Se cambio que el campo de conciliación completa en los vouchers no se pueda seleccionar cuando la linea provenga de una nota de credito

To post a comment you must log in.
938. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

939. By Julio Serna-http://www.vauxoo.com

[MERGE]modified module account_invoice_number changed replace by attributes

940. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

941. By Sabrina Romero - http://www.vauxoo.com

[MERGE] account_asset_move_check module added.

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

Se repiten muchas veces el mismo fragmento de codigo, se puede hacer un metodo generico y que los 3 metodos lo usen esto va a reducir el codigo.

review: Needs Fixing
942. By Julio Serna-http://www.vauxoo.com

[MERGE]addded report webkit to report partner balance

943. By Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com

[MERGE] Changed name of module in link to Manejo de Tareas and changed http to https

944. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

945. By Isaac López Zúñiga

[MERGE] report_multicompany added

946. By Julio Serna-http://www.vauxoo.com

[MERGE] validate folio_id not is duplicate

947. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][report_multicompany]Changed field report_name of text to related
[IMP][report_multicompany]Changed function create and report_multicompany_create where the sequence is assigning by sequence minimal
[IMP][report_multicompany] Improvement view, added search view
IIMP][report_multicompany] Added default in sequence = 10

Merge from: lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo_report_multicompany_imp_dev_jorge

948. By Sabrina Romero - http://www.vauxoo.com

[FIX][debit_credit_note] Error fixed in value assigning to the 'origin' field.

949. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

950. By Yanina Aular (Vauxoo)

[FIX] Error message for captcha changed

951. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

952. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

953. By Isaac López Zúñiga

[MERGE] report_multicompany_create receives company_id

954. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

955. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

956. By Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com

[IMP] For we can add a widget with binary fields we add a new template that allows show the binary fields with bootstrap style

957. By Launchpad Translations on behalf of vauxoo

Launchpad automatic translations update.

958. By hbto [Vauxoo] http://www.vauxoo.com

[IMP] Decoupling Functionality from Fiscal Requirements in OVL

959. By Julio Serna-http://www.vauxoo.com

[IMP] validate line of refund

960. By Julio Serna-http://www.vauxoo.com

[MERGE] conflict resolved in merge

961. By Julio Serna-http://www.vauxoo.com

[IMP]get cr and dr in each onchange by function get_cr_dr

962. By Julio Serna-http://www.vauxoo.com

[PEP8]

963. By Julio Serna-http://www.vauxoo.com

[IMP] readonly = True in amount when in line of refund

964. By Julio Serna-http://www.vauxoo.com

[IMP]not concile refund line in payment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher_no_check_default/__openerp__.py'
2--- account_voucher_no_check_default/__openerp__.py 2013-10-29 21:56:46 +0000
3+++ account_voucher_no_check_default/__openerp__.py 2014-03-07 01:28:12 +0000
4@@ -40,7 +40,8 @@
5 ],
6 "demo" : [],
7 "data" : [
8- "view/voucher_payment_receipt_view.xml"],
9+ "view/voucher_payment_receipt_view.xml"
10+ ],
11 'js': [],
12 'qweb' : [],
13 'css':[],
14
15=== modified file 'account_voucher_no_check_default/account_voucher.py'
16--- account_voucher_no_check_default/account_voucher.py 2013-08-06 19:34:02 +0000
17+++ account_voucher_no_check_default/account_voucher.py 2014-03-07 01:28:12 +0000
18@@ -28,17 +28,112 @@
19 class account_voucher(osv.Model):
20 _inherit = 'account.voucher'
21
22+ def get_cr_dr(self, cr, uid, ids, values, ttype, amount, context=None):
23+ move_exclude = []
24+ if values.get('line_cr_ids', False) and ttype == 'payment' and amount >= 0:
25+ move_exclude = [
26+ self.get_move_exclude(cr, uid, ids, line, context=context)
27+ for line in values.get('line_cr_ids') ]
28+ if values.get('line_dr_ids', False) and ttype == 'receipt' and amount >= 0:
29+ move_exclude = [
30+ self.get_move_exclude(cr, uid, ids, line, context=context)
31+ for line in values.get('line_dr_ids') ]
32+ return move_exclude
33+
34+ def get_move_exclude(self, cr, uid, ids, line, context=None):
35+ acc_move_line_obj = self.pool.get('account.move.line')
36+ acc_invoice_obj = self.pool.get('account.invoice')
37+
38+ acc_line = line.get('move_line_id', False)
39+ move_exclude = False
40+ move_id = acc_line and acc_move_line_obj.browse(cr, uid, acc_line,\
41+ context=context).move_id or False
42+ invoice_line = move_id and acc_invoice_obj.search(cr, uid, [\
43+ ('move_id', '=', move_id.id)], context=context) or False
44+ if invoice_line:
45+ line.update({'reconcile' : False, 'line_to_invoice' : True, 'amount': 0})
46+ move_exclude = acc_line
47+ return move_exclude
48+
49+ def move_include(self, cr, uid, values, val_exclude, context=None):
50+ value_cr = [ val_cr.get('move_line_id', False)
51+ for val_cr in values.get('line_cr_ids', {}) ]
52+
53+ value_dr = [ val_dr.get('move_line_id', False)
54+ for val_dr in values.get('line_dr_ids', {}) ]
55+
56+ return list(set(value_cr + value_dr) - set(val_exclude))
57+
58+ def recompute_moves(self, cr, uid, ids, partner_id, journal_id, amount, currency_id,
59+ ttype, date, values, move_exclude, context=None):
60+
61+ move_include = self.move_include(cr, uid, values, move_exclude, context=context)
62+ context['move_line_ids'] = move_include
63+
64+ result = self.recompute_voucher_lines(cr, uid, ids, partner_id, journal_id,
65+ amount, currency_id, ttype, date, context=context)
66+ values_new = result.get('value', {})
67+
68+ for val_cr in values.get('line_cr_ids', {}):
69+ val_cr.update({'amount': line['amount']
70+ for line in values_new.get('line_cr_ids')
71+ if line['move_line_id'] == val_cr['move_line_id']})
72+
73+ for val_dr in values.get('line_dr_ids', {}):
74+ val_dr.update({'amount': line['amount']
75+ for line in values_new.get('line_dr_ids')
76+ if line['move_line_id'] == val_dr['move_line_id']})
77+ return True
78+
79 def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id,\
80 amount, currency_id, ttype, date, context=None):
81- res = super(account_voucher, self).onchange_partner_id(cr, uid, ids,\
82- partner_id, journal_id, amount, currency_id, ttype, date,\
83- context=context)
84- values = res.get('value', False)
85- if values and values.get('line_cr_ids') and ttype == 'payment':
86- for line in values.get('line_cr_ids'):
87- line.update({'reconcile' : False})
88- if values and values.get('line_dr_ids') and ttype == 'receipt':
89- for line in values.get('line_dr_ids'):
90- line.update({'reconcile' : False})
91- return res
92-
93+ if context is None:
94+ context = {}
95+ res = super(account_voucher, self).onchange_partner_id(cr, uid, ids, partner_id,\
96+ journal_id, amount, currency_id, ttype, date, context=context)
97+ values = res.get('value', {})
98+
99+ move_exclude = self.get_cr_dr(cr, uid, ids, values, ttype, amount, context=context)
100+
101+ self.recompute_moves(cr, uid, ids, partner_id, journal_id, amount, currency_id,
102+ ttype, date, values, move_exclude, context=context)
103+ return res
104+
105+ def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id,\
106+ ttype, date, payment_rate_currency_id, company_id, context=None):
107+ if context is None:
108+ context = {}
109+
110+ res = super(account_voucher, self).onchange_partner_id(cr, uid, ids, partner_id,\
111+ journal_id, amount, currency_id, ttype, date, context=context)
112+ values = res.get('value', {})
113+
114+ move_exclude = self.get_cr_dr(cr, uid, ids, values, ttype, amount, context=context)
115+
116+ self.recompute_moves(cr, uid, ids, partner_id, journal_id, amount, currency_id,
117+ ttype, date, values, move_exclude, context=context)
118+ return res
119+
120+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id,\
121+ partner_id, date, amount, ttype, company_id, context=None):
122+ if context is None:
123+ context = {}
124+
125+ res = super(account_voucher, self).onchange_journal(cr, uid, ids, journal_id, line_ids,\
126+ tax_id, partner_id, date, amount, ttype, company_id, context=context)
127+ values = res and res.get('value', {}) or {}
128+
129+ move_exclude = self.get_cr_dr(cr, uid, ids, values, ttype, amount, context=context)
130+
131+ self.recompute_moves(cr, uid, ids, partner_id, journal_id, amount,
132+ values.get('currency_id', False), ttype, date, values,
133+ move_exclude, context=context)
134+ return res
135+
136+class account_voucher_line(osv.Model):
137+ _inherit = 'account.voucher.line'
138+
139+ _columns = {
140+ 'line_to_invoice': fields.boolean('Line to Invoice', help='If this field is true indicates'\
141+ ' that this line coming from an invoice refound')
142+ }
143
144=== modified file 'account_voucher_no_check_default/view/voucher_payment_receipt_view.xml'
145--- account_voucher_no_check_default/view/voucher_payment_receipt_view.xml 2013-10-29 21:56:46 +0000
146+++ account_voucher_no_check_default/view/voucher_payment_receipt_view.xml 2014-03-07 01:28:12 +0000
147@@ -1,24 +1,36 @@
148 <?xml version='1.0' encoding='utf-8'?>
149 <openerp>
150 <data>
151- <record model="ir.ui.view" id="view_vendor_payment_form_inherit">
152- <field name="name">account.voucher.payment.form.inherit</field>
153+ <record model="ir.ui.view" id="view_vendor_payment_form_inherit_reconcile">
154+ <field name="name">account.voucher.payment.form.inherit.reconcile</field>
155 <field name="model">account.voucher</field>
156 <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
157 <field name="arch" type="xml">
158- <xpath expr="//field[@name='line_cr_ids']" position="attributes">
159- <attribute name="readonly">1</attribute>
160+ <xpath expr="//field[@name='line_cr_ids']/tree/field[@name='reconcile']" position="after">
161+ <field name='line_to_invoice' invisible="1"/>
162+ </xpath>
163+ <xpath expr="//field[@name='line_cr_ids']/tree/field[@name='reconcile']" position="attributes">
164+ <attribute name="attrs">{'readonly': [('line_to_invoice', '=', True)]}</attribute>
165+ </xpath>
166+ <xpath expr="//field[@name='line_cr_ids']/tree/field[@name='amount']" position="attributes">
167+ <attribute name="attrs">{'readonly': [('line_to_invoice', '=', True)]}</attribute>
168 </xpath>
169 </field>
170 </record>
171
172- <record model="ir.ui.view" id="view_vendor_receipt_form_inherit3">
173- <field name="name">account.voucher.receipt.form.inherit3</field>
174+ <record model="ir.ui.view" id="view_vendor_receipt_form_inherit_reconcile">
175+ <field name="name">account.voucher.receipt.form.inherit.reconcile</field>
176 <field name="model">account.voucher</field>
177 <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
178 <field name="arch" type="xml">
179- <xpath expr="//field[@name='line_dr_ids']" position="attributes">
180- <attribute name="readonly">1</attribute>
181+ <xpath expr="//field[@name='line_dr_ids']/tree/field[@name='reconcile']" position="after">
182+ <field name='line_to_invoice' invisible="1"/>
183+ </xpath>
184+ <xpath expr="//field[@name='line_dr_ids']/tree/field[@name='reconcile']" position="attributes">
185+ <attribute name="attrs">{'readonly': [('line_to_invoice', '=', True)]}</attribute>
186+ </xpath>
187+ <xpath expr="//field[@name='line_dr_ids']/tree/field[@name='amount']" position="attributes">
188+ <attribute name="attrs">{'readonly': [('line_to_invoice', '=', True)]}</attribute>
189 </xpath>
190 </field>
191 </record>