-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
[11.0][NEW] website_sale_product_minimal_price: New module #283
[11.0][NEW] website_sale_product_minimal_price: New module #283
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.
And please rebase for solving Travis
#. Go to backend and set a product with variants and extra price by attribute | ||
value. | ||
#. Go to Website Shop. | ||
#. You will see that in main products view appears the text "From " with |
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.
From
text appears always or only when there are multiple prices? It should be the second IMO. Please specify this in the README when done.
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.
Yes
_inherit = 'product.template' | ||
|
||
def _website_price(self): | ||
templates = self.filtered(lambda x: x.product_variant_count > 1) |
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.
This should be for variants with different prices, not with variants only.
<template id="products_item" inherit_id="website_sale.products_item"> | ||
<!-- Display "From" if variants have distinct extra prices --> | ||
<xpath expr="//span[@t-esc='product.website_price']" position="before"> | ||
<t t-if="product.product_variant_count > 1 and len(set(product.product_variant_ids.mapped('price_extra'))) != 1"> |
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.
For achieving this, maybe you need an extra computed stored field at template level for indicating if there are different prices.
6717710
to
ddf7200
Compare
@pedrobaeza chages done |
for template in self: | ||
if (template.product_variant_count and len(set( | ||
template.product_variant_ids.mapped('price_extra'))) != 1): | ||
template.has_variant_price_extra = True |
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.
This never can't be False if sometime is True?
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.
The field is computed, so by default is False
ddf7200
to
4bf95a5
Compare
Changes done!! |
4bf95a5
to
ec6b072
Compare
@pedrobaeza please do not merge!! |
Ok |
38b97a4
to
4735d41
Compare
…ant price (from pricelists or extra variant price)
4735d41
to
2f1d1ba
Compare
for product in templates: | ||
variant = product.product_variant_ids.sorted( | ||
key=lambda p: p.website_price)[:1] | ||
product.website_price = variant.website_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.
Here can use .write
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.
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price)
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
* [11.0][NEW] website_sale_product_minimal_price: New module * [11.0][IMP] website_sale_product_minimal_price: Order by minimal variant price (from pricelists or extra variant price) [UPD] Update website_sale_product_minimal_price.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_minimal_price Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_minimal_price/ [UPD] README.rst
cc @Tecnativa