[IMP] pre-commit: first run on whole repo
This commit is contained in:
@@ -2,31 +2,34 @@
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
_inherit = "account.move.line"
|
||||
|
||||
sale_id = fields.Many2one('sale.order', string='Sale Order')
|
||||
sale_id = fields.Many2one("sale.order", string="Sale Order")
|
||||
account_internal_type = fields.Selection(
|
||||
related='account_id.user_type_id.type', store=True,
|
||||
string='Account Internal Type')
|
||||
related="account_id.user_type_id.type",
|
||||
store=True,
|
||||
string="Account Internal Type",
|
||||
)
|
||||
|
||||
@api.constrains('sale_id', 'account_id')
|
||||
@api.constrains("sale_id", "account_id")
|
||||
def sale_id_check(self):
|
||||
for line in self:
|
||||
if line.sale_id and line.account_id.internal_type != 'receivable':
|
||||
raise ValidationError(_(
|
||||
"The account move line '%s' is linked to sale order '%s' "
|
||||
"but it uses account '%s' which is not a receivable "
|
||||
"account.")
|
||||
% (line.name,
|
||||
line.sale_id.name,
|
||||
line.account_id.display_name))
|
||||
if line.sale_id and line.account_id.internal_type != "receivable":
|
||||
raise ValidationError(
|
||||
_(
|
||||
"The account move line '%s' is linked to sale order '%s' "
|
||||
"but it uses account '%s' which is not a receivable "
|
||||
"account."
|
||||
)
|
||||
% (line.name, line.sale_id.name, line.account_id.display_name)
|
||||
)
|
||||
|
||||
@api.onchange('account_id')
|
||||
@api.onchange("account_id")
|
||||
def sale_advance_payement_account_id_change(self):
|
||||
if self.sale_id and self.account_id.user_type_id.type != 'receivable':
|
||||
if self.sale_id and self.account_id.user_type_id.type != "receivable":
|
||||
self.sale_id = False
|
||||
|
||||
Reference in New Issue
Block a user