[trunk] sale.order.line.make.invoice and purchase.order.line.invoice are impossible to extend

Bug #1229750 reported by Alexandre Fayolle - camptocamp
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Low
OpenERP R&D Addons Team 3

Bug Description

The code in the two wizards sale.order.line.make.invoice and purchase.order.line.invoice needs fixing:

* it uses inner function to create the invoices and invoice lines, which makes it impossible to extend using the standard openerp practices (_inherit + super())
* it bypasses the _prepare_invoice_line methods of sale order and purchase orders

the net effect is that the customizations need to be written twice, and one of the places is awkward (requires complete rewrite of the wizard implementation, which in turns breaks separation of concern through different modules extending the same object)

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Alexandre,

Would you please explain this with complete example. So I can do a test on it.

Thank you

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenERP Addons because there has been no activity for 60 days.]

Changed in openobject-addons:
status: Incomplete → Expired
Changed in openobject-addons:
status: Expired → Invalid
Changed in openobject-addons:
status: Invalid → New
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Sorry, I missed the request for clarification

Suppose I want to extend sale orders to e.g. add a field on sale.order.lines which needs to be processed when creating invoices. For example I add a field 'special_offer' on the sale.order.line and a field 'special_offer' on the account.invoice.line and I want the value of the field in the sale order line to be copied to the account invoice line when the invoice is generated.

As long as the default process for invoice generation is used, I can override in my model the _prepare_order_line_invoice_line method of sale.order and be happy.

But if my customer uses the sale.order.line.make.invoice wizard, then my customizations are not processed. And to fix the wizard I need to make deep changes because of the inner function which cannot be overridden and these changes are duplications of what I have in _prepare_order_line_invoice_line which is a Bad Thing.

Thanks for taking this into account at least in trunk.

Revision history for this message
Amit Patel (amitkumarnpatel) wrote :

Hello,
          I tested this senario but i got the same problem while overriding the '_prepare_order_line_invoice_line' method.

Thanks

Changed in openobject-addons:
status: New → Confirmed
Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.