Sales Order had a single visible `tax_article` link field while Sales Invoice had long since moved to a multi-select: several articles per item row, held in a parent-level table and tied to the row by a generated key. The two had to match, so Sales Order now gets the same picker — and the same exclusions. Rather than copy 250 lines of dialog code into a second file that would drift, the behaviour moves to item_tax_articles.js, which takes the doctype, the item doctype, the child doctype, the table field and the row-key field as config. sales_invoice_tax_articles.js and sales_order_tax_articles.js are now shims that call .init() with their own config. Same split server-side: item_tax_articles.py holds the validate logic, the two custom/*_tax_articles.py are entry points. Sales Order keeps its own child DocType rather than reusing the invoice's. The downstream consumers (VAT Allocation, the tax reports) anchor their joins on `tabSales Invoice`, so sharing one table would be safe today — but a single future query written without that join would pull sales orders into a filed tax return, and that is not a trap worth leaving armed. Articles ride into the invoice on conversion: get_mapped_doc only walks the standard field map, so make_sales_invoice is wrapped to carry them across, matching order rows to invoice rows via `so_detail`. Row keys are regenerated, not copied — they are no_copy and the two documents key their rows independently. `Sales Order Item.tax_article` becomes hidden/read-only/deprecated, exactly as on Sales Invoice. Nothing referenced it (the table is empty), and vat_calculator.js — which drove it, and which still serves any doctype using the plain link field — now skips Sales Order the same way it already skipped Sales Invoice, so it no longer clears a hidden field and dirties the form on every refresh. The 302.6 / 302.6.1 exclusion added for Sales Invoice was reachable around: the dialog filtered them out, but the collapsible "Item Tax Articles" table on the parent let you pick them directly. Both child DocTypes now carry the same `not like 302.6%` in link_filters, which is what guards that path. Verified end-to-end against the live site (rolled back): an order with two articles converts to an invoice that keeps both, under a fresh row key, surviving validate. Both forms checked headless — shared module loads, cells render, legacy field hidden, no JS errors, and Sales Invoice is unregressed by the refactor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| jey_erp | ||
| .gitignore | ||
| BANK_INTEGRATION_PLAN.md | ||
| README.md | ||
| TASK_CONTEXT.md | ||
| license.txt | ||
| pyproject.toml | ||
README.md
Jey Erp
Azərbaycan localization for JeyERP
License
unlicense