Browse Source

operate on the whole set, like parent [ci skip]

pull/96/head
Stefan Becker 7 years ago
parent
commit
375076c470
  1. 7
      contract_purchase/models/account.py

7
contract_purchase/models/account.py

@ -15,12 +15,12 @@ class AccountAnalyticAccount(models.Model):
@api.multi @api.multi
def _prepare_invoice(self): def _prepare_invoice(self):
self.ensure_one()
contract = self[:1]
if self.type == 'purchase':
if contract.type == 'purchase':
journal = self.env['account.journal'].search([ journal = self.env['account.journal'].search([
('type', '=', 'purchase'), ('type', '=', 'purchase'),
('company_id', '=', self.company_id.id)
('company_id', '=', contract.company_id.id)
], limit=1) ], limit=1)
res = super( res = super(
@ -31,7 +31,6 @@ class AccountAnalyticAccount(models.Model):
)._prepare_invoice() )._prepare_invoice()
res.update({ res.update({
'journal_id': journal.id,
'type': 'in_invoice' 'type': 'in_invoice'
}) })

Loading…
Cancel
Save