[Bug]: Italian Posted Sales Invoice update page shadows W1 functionality
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 683
- Forks
- 459
- Avg merge
- 3d 26m
- Merged PRs (30d)
- 633
Description
Describe the issue
In the Italian localization, the Update Document action on a posted sales invoice uses a separate IT-specific implementation instead of reusing/extending the W1 posted sales invoice update functionality.
W1 uses:
- Page 1355
"Posted Sales Inv. - Update" - Codeunit 1409
"Sales Inv. Header - Edit"
The Italian localization instead uses:
- Page 12211
"Posted Sales Invoice - Update" - Codeunit 12186
"Sales Invoice Header - Edit"
The W1 update page currently supports editing several fields on a posted sales invoice, including Payment Method Code, Payment Reference, Company Bank Account Code, Posting Description, Due Date, Promised Pay Date, Dispute Status, Your Reference, and shipping-related fields.
Codeunit 1409 also implements the associated update logic, including propagating fields such as Payment Method Code to the related Customer Ledger Entry.
The Italian page 12211, however, only exposes Fattura Document Type, and codeunit 12186 only copies that field to the posted Sales Invoice Header.
As a result, functionality added to the W1 posted-document update mechanism is unavailable in the Italian localization.
A concrete example is Payment Method Code: W1 explicitly supports correcting it on an already posted invoice and synchronizes the related Customer Ledger Entry, while the Italian localization does not expose that functionality.
This appears to be caused by the Italian localization maintaining a parallel implementation of the posted-document update mechanism rather than extending the W1 implementation.
Expected behavior
The Italian localization should retain its localization-specific Fattura Document Type functionality while also inheriting the standard W1 posted sales invoice update functionality.
Ideally, the Italian implementation could reuse page 1355 "Posted Sales Inv. - Update" and codeunit 1409 "Sales Inv. Header - Edit" instead of maintaining parallel objects.
The existing W1 extensibility points appear sufficient for this:
- Extend page 1355 with
Fattura Document Type. - Subscribe to
OnAfterRecordChangedon page 1355 so a change toFattura Document Typeis considered when deciding whether the record changed. - Subscribe to
OnRunOnBeforeAssignValuesin codeunit 1409 to copyFattura Document Typeto the persistedSales Invoice Header.
Conceptually, the page subscriber would add the localization-specific comparison:
IsChanged :=
IsChanged or
(SalesInvoiceHeader."Fattura Document Type" <>
xSalesInvoiceHeader."Fattura Document Type");
and the codeunit subscriber could copy the field:
SalesInvoiceHeader."Fattura Document Type" :=
SalesInvoiceHeaderRec."Fattura Document Type";
This would preserve the Italian-specific behavior while allowing Italy to automatically inherit the standard W1 update functionality and future improvements.
The existing IT-specific page 12211 and codeunit 12186 could then be obsoleted as appropriate, subject to compatibility requirements.
Steps to reproduce
- Use Business Central with the Italian localization.
- Create and post a sales invoice.
- Leave
Payment Method Codeblank before posting, or otherwise have a posted invoice whose Payment Method Code needs to be corrected. - Open the posted sales invoice.
- Choose Update Document.
- Observe that the update page only exposes
Fattura Document Type. - Compare this with W1 page 1355
"Posted Sales Inv. - Update", wherePayment Method Codeand the other supported editable posted-document fields are available.
The Italian Posted Sales Invoice implementation invokes its local "Posted Sales Invoice - Update" page, so the W1 page 1355 functionality is bypassed.
Additional context
Relevant W1 files:
src/Layers/W1/BaseApp/Sales/History/PostedSalesInvUpdate.Page.alsrc/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al
Relevant Italian files:
src/Layers/IT/BaseApp/Local/Sales/History/PostedSalesInvoiceUpdate.Page.alsrc/Layers/IT/BaseApp/Local/Sales/History/SalesInvoiceHeaderEdit.Codeunit.alsrc/Layers/IT/BaseApp/Sales/History/PostedSalesInvoice.Page.al
There is also an existing Italian test covering the localization-specific update mechanism:
src/Layers/IT/Tests/Local/FatturaPAUpdatePostedDoc.Codeunit.al
That test currently verifies that Fattura Document Type can be changed through the Italian update page. It could potentially be adapted to verify the same behavior through the extended W1 page after the refactoring.
The issue is broader than the currently observed Payment Method Code case: because the Italian localization maintains a separate implementation, additions and fixes made to the W1 posted-invoice update mechanism can be unavailable in Italy unless they are independently duplicated in the localization.
Refactoring the Italian functionality as an extension of the W1 mechanism would reduce this duplication and avoid similar divergence in the future.
I will provide a fix for a bug
- I will provide a fix for a bug
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the W1 page and codeunit in src/Layers/W1/BaseApp/Sales/History/PostedSalesInvUpdate.Page.al and SalesInvHeaderEdit.Codeunit.al, then compare the Italian page and codeunit under src/Layers/IT/BaseApp/Local/Sales/History/. Run src/Layers/IT/Tests/Local/FatturaPAUpdatePostedDoc.Codeunit.al first. Done means Italian Fattura Document Type behavior remains covered while the W1 posted-invoice update fields are available through the shared mechanism.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100