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
[12.0] ADD pos_product_multi_price: Make pricelists based on product_multi_price work in point of sale #541
Conversation
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.
Functional test ok!
@OCA/pos-maintainers what do you think? |
…rice work in point of sale
5255e54
to
0f2789c
Compare
Conflict fixed |
_.find(pricelist_items, function (rule) { | ||
if (rule.min_quantity && quantity < rule.min_quantity) { | ||
return false; | ||
} | ||
if (rule.base === 'multi_price' && rule.compute_price == 'formula') { | ||
_.forEach(price_ids_json, function (multi_price) { | ||
if (multi_price.price_id == rule.multi_price_name[0]) { | ||
price = multi_price.price; | ||
var price_limit = price; | ||
price = price - (price * (rule.price_discount / 100)); | ||
if (rule.price_round) { | ||
price = round_pr(price, rule.price_round); | ||
} | ||
if (rule.price_surcharge) { | ||
price += rule.price_surcharge; | ||
} | ||
if (rule.price_min_margin) { | ||
price = Math.max(price, price_limit + rule.price_min_margin); | ||
} | ||
if (rule.price_max_margin) { | ||
price = Math.min(price, price_limit + rule.price_max_margin); | ||
} | ||
return true; | ||
} | ||
}); | ||
} | ||
return 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.
Here you ignore possible high-priority rules not based on multi_price.
Price set by those high-priority rules will be overridden by the multi_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.
Doesn't the same happen with product_multi_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.
No it doesn't.
If you have a rule like "50% of standard price on product variant A" and a second rule "Use multi_price X for all products", when you create a sale order for product A, the price will be 50% of the standard price.
The second rule won't override the first one.
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.
also check @qgroulard 's comment :)
# technical field used in POS frontend | ||
price_ids_json = fields.Char( | ||
"Multi price data dict", readonly=True, | ||
compute="_compute_price_ids_json") |
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.
# technical field used in POS frontend | |
price_ids_json = fields.Char( | |
"Multi price data dict", readonly=True, | |
compute="_compute_price_ids_json") | |
price_ids_json = fields.Char( | |
"Multi price data dict", | |
help="Technical field used in POS frontend", | |
compute="_compute_price_ids_json", | |
) |
- computed fields are already readonly by default.
- you can move the comment to the help attribute, it's more helpful this way
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.
Works correctly also on V13
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Hi @legalsylvain any chance for this PR? |
See
product_multi_price
's documentation about how to configure and use it.