Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
Global discount on Customer Invoice
Hello, I am using v9 and I am trying to apply global discount in customer invoices. I am trying the user solution given here:
https://www.odoo.com/forum/help-1/question/how-to-give-discount-on-the-total-of-a-sales-order-6600
I have created a float field called x_global_invoice_discount , I am displaying that field in the account.invoice form and I have placed the method inside the file "/addons/account/models/account_invoice.py" in the class AccountInvoice but I am getting "undifiend object 'apply.discount' in model 'account.invoice'"
If i place the code in the file "/addons/sale/sale.py" in the class AccountInvoice then no error, but nothing happens. I am tailing the log file and the onchange event doesn't trigger :/
I am new in odoo and in python as I was writing in php and java so far... some help will be much appreciated!
The goal is: The user will add all the products he wants, then he will input the discount (eg 10%) and the value of that field should be applied in the discount field in the invoice lines. Finally the order total should be updated. In a most advanced version of this the discount should be put in each customer and applied automatically in the invoice lines.
I can provide additional info and screenshots if needed.
Thank you for your answer Ermin. I have tried quite a few modules but unfortunately the v8 and v7modules don't work on v9. The v9 module you are suggesting does not calculate the discount on the product lines also it is a paid one and I am not willing to pay 25E for such a simple task, moreover it has only 1-star rating.
I am a programmer myself but unfamiliar with python and odoo so I am asking for some help with the code :)
I did mention the modules for 8.0 as a guide to coding it yourself or you might even think about porting one of the modules to 9.0.
after a lot trial and error I have modified a v.8 module to work on v.9 but I am encountering a very strange bug which I cant seem to fix nor understand why it is happening. I have added some code that reads the value of the global discount and places it in the line.discount field of each product. The first time I click "update" to update the invoice lines with the new discount everything works fine. If I change the global discount again then only the 1st product discount field is updated. The other products' discount fields keep the old value. I keep banging my head on the wall with that but I can't figure it out....
I would really appreciate it if you could help me!
There is an app available for 9.0: https://www.odoo.com/apps/modules/9.0/sale_invoice_global_discount/
and this one might help you https://www.odoo.com/apps/modules/8.0/sale_discount_total/ or this https://www.odoo.com/apps/modules/8.0/sale_global_three_discounts/
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 7/2/16, 9:16 AM |
Seen: 1608 times |
Last updated: 3/13/18, 3:31 AM |