mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Make the failing test passes, the fields is named supplier_invoice_number
not supplier_invoice_reference Conflicts: account_invoice_reference/account_invoice.py Wrong cherry-pick
This commit is contained in:
@@ -79,22 +79,23 @@ class AccountInvoice(orm.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
if (vals.get('supplier_invoice_reference') and not
|
if (vals.get('supplier_invoice_number') and not
|
||||||
vals.get('reference')):
|
vals.get('reference')):
|
||||||
vals['reference'] = vals['supplier_invoice_reference']
|
vals = vals.copy()
|
||||||
|
vals['reference'] = vals['supplier_invoice_number']
|
||||||
return super(AccountInvoice, self).create(cr, uid, vals,
|
return super(AccountInvoice, self).create(cr, uid, vals,
|
||||||
context=context)
|
context=context)
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
if vals.get('supplier_invoice_reference'):
|
if vals.get('supplier_invoice_number'):
|
||||||
if isinstance(ids, (int, long)):
|
|
||||||
ids = [ids]
|
|
||||||
for invoice in self.browse(cr, uid, ids, context=context):
|
for invoice in self.browse(cr, uid, ids, context=context):
|
||||||
|
loc_vals = None
|
||||||
if not invoice.reference:
|
if not invoice.reference:
|
||||||
locvals = vals.copy()
|
loc_vals = vals.copy()
|
||||||
locvals['reference'] = vals['supplier_invoice_reference']
|
loc_vals['reference'] = vals['supplier_invoice_number']
|
||||||
super(AccountInvoice, self).write(cr, uid, [invoice.id],
|
super(AccountInvoice, self).write(cr, uid, [invoice.id],
|
||||||
locvals, context=context)
|
loc_vals or vals,
|
||||||
|
context=context)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return super(AccountInvoice, self).write(cr, uid, ids, vals,
|
return super(AccountInvoice, self).write(cr, uid, ids, vals,
|
||||||
|
|||||||
Reference in New Issue
Block a user