[FIX] l10n_be_invoice_bba: correct fix of algorithm stuff, previous commit was pure bullshit
bzr revid: qdp-launchpad@openerp.com-20120718122636-3njcyy79d35k3rnt
This commit is contained in:
parent
803220f3b7
commit
a93a1a0937
|
@ -12,7 +12,7 @@
|
||||||
<field name="payment_term" position="after">
|
<field name="payment_term" position="after">
|
||||||
<group col="4" colspan="2">
|
<group col="4" colspan="2">
|
||||||
<field name="reference_type" nolabel="1" size="0" attrs="{'readonly':[('state','!=','draft')]}"
|
<field name="reference_type" nolabel="1" size="0" attrs="{'readonly':[('state','!=','draft')]}"
|
||||||
on_change="generate_bbacomm(type,reference_type, partner_id.out_inv_comm_algorithm, partner_id,reference)" colspan="1"/>
|
on_change="generate_bbacomm(type,reference_type, partner_id,reference, context)" colspan="1"/>
|
||||||
<field name="reference" nolabel="1" colspan="3" attrs="{'readonly':[('state','!=','draft')]}"/>
|
<field name="reference" nolabel="1" colspan="3" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||||
</group>
|
</group>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -75,10 +75,7 @@ class account_invoice(osv.osv):
|
||||||
if (type == 'out_invoice'):
|
if (type == 'out_invoice'):
|
||||||
reference_type = self.pool.get('res.partner').browse(cr, uid, partner_id).out_inv_comm_type
|
reference_type = self.pool.get('res.partner').browse(cr, uid, partner_id).out_inv_comm_type
|
||||||
if reference_type:
|
if reference_type:
|
||||||
algorithm = self.pool.get('res.partner').browse(cr, uid, partner_id).out_inv_comm_algorithm
|
reference = self.generate_bbacomm(cr, uid, ids, type, reference_type, partner_id, '', context={})['value']['reference']
|
||||||
if not algorithm:
|
|
||||||
algorithm = 'random'
|
|
||||||
reference = self.generate_bbacomm(cr, uid, ids, type, reference_type, algorithm, partner_id, '')['value']['reference']
|
|
||||||
res_update = {
|
res_update = {
|
||||||
'reference_type': reference_type or 'none',
|
'reference_type': reference_type or 'none',
|
||||||
'reference': reference,
|
'reference': reference,
|
||||||
|
@ -86,17 +83,15 @@ class account_invoice(osv.osv):
|
||||||
result['value'].update(res_update)
|
result['value'].update(res_update)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def generate_bbacomm(self, cr, uid, ids, type, reference_type, algorithm, partner_id, reference):
|
def generate_bbacomm(self, cr, uid, ids, type, reference_type, partner_id, reference, context=None):
|
||||||
partner_obj = self.pool.get('res.partner')
|
partner_obj = self.pool.get('res.partner')
|
||||||
reference = reference or ''
|
reference = reference or ''
|
||||||
|
algorithm = False
|
||||||
|
if partner_id:
|
||||||
|
algorithm = partner_obj.browse(cr, uid, partner_id, context=context).out_inv_comm_algorithm
|
||||||
|
algorithm = algorithm or 'random'
|
||||||
if (type == 'out_invoice'):
|
if (type == 'out_invoice'):
|
||||||
if reference_type == 'bba':
|
if reference_type == 'bba':
|
||||||
if not algorithm:
|
|
||||||
if partner_id:
|
|
||||||
algorithm = partner_obj.browse(cr, uid, partner_id).out_inv_comm_algorithm
|
|
||||||
if not algorithm:
|
|
||||||
if not algorithm:
|
|
||||||
algorithm = 'random'
|
|
||||||
if algorithm == 'date':
|
if algorithm == 'date':
|
||||||
if not self.check_bbacomm(reference):
|
if not self.check_bbacomm(reference):
|
||||||
doy = time.strftime('%j')
|
doy = time.strftime('%j')
|
||||||
|
|
Loading…
Reference in New Issue