mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
Merge pull request #35 from OpenPymeMx/7.0
Correct set accounting accounts for auto generated invoices on multicompany environment
This commit is contained in:
@@ -169,7 +169,7 @@ class AccountAnalyticAccount(orm.Model):
|
||||
raise orm.except_orm(
|
||||
_('Error!'),
|
||||
_('Please define a sale journal for the company "%s".') %
|
||||
(contract.company_id.name or '', ))
|
||||
(contract.company_id.name or '',))
|
||||
partner_payment_term = contract.partner_id.property_payment_term.id
|
||||
inv_data = {
|
||||
'reference': contract.code or False,
|
||||
@@ -241,10 +241,16 @@ class AccountAnalyticAccount(orm.Model):
|
||||
new_date = next_date + relativedelta(months=+interval)
|
||||
context['old_date'] = old_date
|
||||
context['next_date'] = new_date
|
||||
# Force company for correct evaluate domain access rules
|
||||
context['force_company'] = contract.company_id.id
|
||||
# Re-read contract with correct company
|
||||
contract = self.browse(cr, uid, contract.id, context=context)
|
||||
self._prepare_invoice(
|
||||
cr, uid, contract, context=context)
|
||||
cr, uid, contract, context=context
|
||||
)
|
||||
self.write(
|
||||
cr, uid, [contract.id],
|
||||
{'recurring_next_date': new_date.strftime('%Y-%m-%d')},
|
||||
context=context)
|
||||
context=context
|
||||
)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user