Skip to content
Permalink
Browse files

[FIX] account_analytic_default: apply same logic as in _prepare_invoi…

…ce_line

It was not possible to manually set a default analytic account as it was
overriden by the onchange, even if no account was returned by account_get

Apply the same logic as in _prepare_invoice_line on sale.order.line
  • Loading branch information...
MohsenWaleed authored and mart-e committed Jan 16, 2019
1 parent 8f2267b commit 39d79e443a5806ec4118182b5850c178ff46aa0a
Showing with 3 additions and 2 deletions.
  1. +3 −2 addons/account_analytic_default/models/account_analytic_default.py
@@ -68,8 +68,9 @@ def _onchange_product_id(self):
res = super(AccountInvoiceLine, self)._onchange_product_id()
rec = self.env['account.analytic.default'].account_get(self.product_id.id, self.invoice_id.commercial_partner_id.id, self.env.uid,
fields.Date.today(), company_id=self.company_id.id)
self.account_analytic_id = rec.analytic_id.id
self.analytic_tag_ids = rec.analytic_tag_ids.ids
if rec:
self.account_analytic_id = rec.analytic_id.id
self.analytic_tag_ids = rec.analytic_tag_ids.ids
return res

def _set_additional_fields(self, invoice):

0 comments on commit 39d79e4

Please sign in to comment.
You can’t perform that action at this time.