Black on account_fiscal_position_payable_receivable

This commit is contained in:
Florian da Costa
2020-11-02 11:33:07 +01:00
parent 7a6600431c
commit 34ec0dfa27
3 changed files with 29 additions and 23 deletions

View File

@@ -5,11 +5,17 @@ from odoo import models, fields
class AccountFiscalPosition(models.Model):
_inherit = 'account.fiscal.position'
_inherit = "account.fiscal.position"
receivable_account_id = fields.Many2one(
'account.account', string='Partner Receivable Account',
company_dependent=True, domain=[('internal_type', '=', 'receivable')])
"account.account",
string="Partner Receivable Account",
company_dependent=True,
domain=[("internal_type", "=", "receivable")],
)
payable_account_id = fields.Many2one(
'account.account', string='Partner Payable Account',
company_dependent=True, domain=[('internal_type', '=', 'payable')])
"account.account",
string="Partner Payable Account",
company_dependent=True,
domain=[("internal_type", "=", "payable")],
)

View File

@@ -5,19 +5,21 @@ from odoo import models, api
class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
@api.onchange('property_account_position_id')
@api.onchange("property_account_position_id")
def fiscal_position_receivable_payable_change(self):
fp = self.property_account_position_id
ipo = self.env['ir.property']
ipo = self.env["ir.property"]
if fp.receivable_account_id:
self.property_account_receivable_id = fp.receivable_account_id
else:
self.property_account_receivable_id = ipo.get(
'property_account_receivable_id', 'res.partner')
"property_account_receivable_id", "res.partner"
)
if fp.payable_account_id:
self.property_account_payable_id = fp.payable_account_id
else:
self.property_account_payable_id = ipo.get(
'property_account_payable_id', 'res.partner')
"property_account_payable_id", "res.partner"
)