Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2096 Lượt xem

Hi i want to overwrite this methode

class AccountMove(models.Model):
_inherit = 'account.move'

def _post(self, soft=True):
# OVERRIDE to check the invoice lines taxes.
for invoice in self.filtered(lambda move: move.is_invoice()):
for line in invoice.invoice_line_ids:
account_tax = line.account_id.tax_ids.ids
if account_tax and invoice.company_id.account_fiscal_country_id.code == 'DE':
account_name = line.account_id.name
for tax in line.tax_ids:
if tax.id not in account_tax:
raise UserError(_('Account %s does not authorize to have tax %s specified on the line. \
Change the tax used in this invoice or remove all taxes from the account') % (account_name, tax.name))
return super()._post(soft)

the problem is can recreate the methode in an own module but the code is stil executed. how can i overwrite this methode exactly or prevent this method from beein called

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 21
14917
1
thg 6 20
5065
0
thg 12 23
1333
5
thg 7 18
23582
2
thg 2 18
33274