Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Thai Localization - VAT and Withholding Tax

Entity: account.move.line

Compute Method: _compute_wht_tax_id

View 18.0
Inputs Method Outputs
  • move_id
  • move_id.move_type
  • product_id
  • product_id.wht_tax_id
  • partner_id
  • move_id.partner_id
  • product_id.supplier_company_wht_tax_id
  • product_id.supplier_wht_tax_id
+ for rec in self:
+             # From invoice, default from product
+             if rec.move_id.move_type in ("out_invoice", "out_refund", "in_receipt"):
+                 rec.wht_tax_id = rec.product_id.wht_tax_id
+             elif rec.move_id.move_type in ("in_invoice", "in_refund", "out_receipt"):
+                 partner_id = rec.partner_id or rec.move_id.partner_id
+                 if partner_id and partner_id.company_type == "company":
+                     rec.wht_tax_id = rec.product_id.supplier_company_wht_tax_id
+                     continue
+                 rec.wht_tax_id = rec.product_id.supplier_wht_tax_id
+             else:
+                 rec.wht_tax_id = False
  • wht_tax_id

Back to entity