-
-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.0] Improve pos_pricelist #39
Conversation
Never manipulate the native Backbone.Model entity like this way because it is considered as bad practice.
…in the POS config to let the user show price with taxes in product widget. - the UI is updated when we change the customer in order to adapt the prices - the computation take in account the pricelist and the fiscal position of the customer
…te the computation depending on the quantity like this output : 1x -> 100 € 3x -> 70 € 5x -> 50 € [IMP] : update readme to indicate the new improvements
@ah-taktik thanks for this improvement. I've tried it in runbot and I've got this client error, with debug actived:
I've fixed with this ugly workaround: module.PosModelParent = module.PosModel;
module.PosModel = module.PosModel.extend({
/**
* @param session
* @param attributes
*/
initialize: function (session, attributes) {
// this.constructor.__super__.initialize.apply(this, arguments);
module.PosModelParent.prototype.initialize.apply(this, arguments);
this.pricelist_engine = new module.PricelistEngine({
'pos': this,
'db': this.db,
'pos_widget': this.pos_widget
});
arrange_elements(this);
}, In other hand, if you set pos.config.display_price_with_taxes = true, then price is showing without taxes in order line. I suggest you to extend get_display_price: function(){
if (this.pos.config.display_price_with_taxes){
return this.get_price_with_tax();
}
return this.constructor.__super__.get_display_price.apply(this, arguments);
}, Finally, I've propused another PR (#38, pos_order_tax_detail), in order to track taxes associated to a |
Hello @antespi, Thanks for your feedback 👍 Thank you. |
Clean way to inherit in JS And improve get_display_price method
initialize: function (attr, options) { | ||
this._super('initialize', attr, options); | ||
OrderlineParent.prototype.initialize.apply(this, arguments); | ||
this.manuel_price = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo-error? Manuel is my son's name 😄 Should it be manual_price?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, exactly 😆
Thanks.
@ah-taktik , thanks for your changes. Are you planning to implement taxes tracking? You should declare another Colletion in Order model, like |
…ead of the sistem-wide default
Hello @antespi, 1x POS Product 1 : 121.00 € 1x POS Product 2 : 112.00 € 1x POS Product 3 : 127.00 € Total: 360.00 € If it's your request, Yeah we can propose a new module to override this method and customize the ticket. Thanks. |
[IMP] The pricelist in the current pos.config is used as default inst…
Hi @ah-taktik, tax tracking in JS (POS offline client) side is ok. We don't need tax detail per line. But in Python (Odoo model) side, pos.order hasn't tax detail, only total tax amount, and when user print a ticket from backend then tax details doesn't appeas. It is quite different compared with ticket printed by POS client. Some customers want to print tickets in PDF once per week to send them to theirs account department or subcontract account expert. In backend, user can select tickets for a week and print them together in one PDFs but account expert can't figure out what amount come from each tax. Is this a common need? or this only happends in Spain? |
It was adding to the product all the right-handed taxes found in the fiscal position, not taking into account the product source tax.
Hi @antespi I'll start working now in trying to add the taxes to the pos.order.line |
@pablocm-aserti We're not working on it right now. I've just overviewed a way to implement it. I think we have to do the same as Odoo standard do for order lines, reusing @ah-taktik code for calculating fiscal position and prices to apply. So, IMHO, there are two collection of taxes:
For example, this Order:
Now, we will care about customer with a fiscal position that add a 5% discount tax to all product, so taxes per Orderline are:
An now, at Order level, we have these taxes:
If you add these two Collections, then when JS object is serialized and sent to Odoo server it will include tax information per |
… of taxes applied on the frontend
@antespi I've come out with a solution for the backend tax incongruences when they were mapped on the frontend that is very similar to what you propose. Comments are welcome here ah-taktik/pos#2 Thanks! |
[FIX] Style and garbage code
[FIX] Fiscal position tax mapping
@ah-taktik, @pablocm-aserti this improvement rocks!! For printing ticket from backend, this could be an example: Taxes are printed at the end of ticket, aggregating each type of tax. This can be calculated in python-side from each order line tax info. |
@ah-taktik , @pablocm-aserti I'm working on it. I'll do a pull request to your branch. I've done before, it's just copy-paste for me. Wait me some time |
@ah-taktik , @pablocm-aserti, here https://github.com/ah-taktik/pos/pull/3 you have my part. |
[IMP] Show aggregated taxes detail in pos.order and when printing ticket
[FIX] Fixes commented by @pablocm-aserti
@antespi, @pablocm-aserti, Thank you for you contribution, it's great ! |
Sorry @ah-taktik, but i forgot to add security ACL rules to This will fix runbot error |
[FIX] Add security file to __openerp__.py
👍 |
Hi @ah-taktik. Just a quick overview. Is it possible to move in a separate module taxes management ? It seem that your module include some taxes detail that could be better in (#38) (Or did I miss something ?) |
Hi @legalsylvain, @antespi, I'd like you feedback here. Thanks in advance. |
@legalsylvain, those PRs (#33, #38) are included in this PR and with a better implementation, because this one take care about pricelist and fiscal position when a customer is selected. This one track properly taxes in pos.order.line and this haven't issues (#38 (comment)) when a product change its taxes. I think that "few addons" criteria is better when possible, and features implemented in this addon are related. So, I prefer to have only one addon: pos_pricelist. Maybe now this name doesn't represent properly features implemented. IMHO, this features should be implemented in ofiicial point_of_sale addon. They aren't optional in any case. All our customers want pricelist and full tax management in POS orders as they have in sale orders and account invoices. In Spain, a POS order (a ticket) is as legal as an invoice, and we have to take care about fiscal position and taxes detail. |
👍 |
👍 Merging... |
@pedrobaeza, Thank you. |
…esheet_invoice [ADD] analytic_partner_hr_timesheet_invoice
[IMP]: improve JS indentation
[IMP]: remove _super method from Backbone.Model. Never manipulate the native Backbone.Model entity like this way because it is considered as bad practice.
[ADD]: Add support for price with taxes, new option is introduced in the POS config to let the user show price with taxes in product widget.
The UI is updated when we change the customer in order to adapt the prices
The computation take in account the pricelist and the fiscal position of the customer
The idea is based on what is done in this PR : #33 by @antespi
[IMP]: simplify JS for price computation (get_all_prices)
[ADD]: When we mouseover the price tag, a tooltip is shown to indicate the computation depending on the quantity like this output :
[IMP] : update readme to indicate the new improvements