| 1 |
import { registry } from "@web/core/registry"; |
| 2 |
import { Base } from "./related_models"; |
| 3 |
|
| 4 |
export class AccountFiscalPosition extends Base { |
| 5 |
static pythonModel = "account.fiscal.position"; |
| 6 |
|
| 7 |
getTaxesAfterFiscalPosition(taxes) { |
| 8 |
if (!this.tax_ids?.length) { |
| 9 |
return []; |
| 10 |
} |
| 11 |
|
| 12 |
const newTaxIds = []; |
| 13 |
for (const tax of taxes) { |
| 14 |
if (this.tax_map[tax.id]) { |
| 15 |
for (const mapTaxId of this.tax_map[tax.id]) { |
| 16 |
newTaxIds.push(mapTaxId); |
| 17 |
} |
| 18 |
} else { |
| 19 |
newTaxIds.push(tax.id); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
return this.models["account.tax"].filter((tax) => newTaxIds.includes(tax.id)); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
registry |
| 28 |
.category("pos_available_models") |
| 29 |
.add(AccountFiscalPosition.pythonModel, AccountFiscalPosition); |