[18.0][MIG] sell_only_by_packaging: Migration to 18.0#10
[18.0][MIG] sell_only_by_packaging: Migration to 18.0#10
Conversation
b651d4a to
aa3479a
Compare
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-16.0/sale-workflow-16.0-sell_only_by_packaging Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sell_only_by_packaging/
Currently translated at 100.0% (15 of 15 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sell_only_by_packaging Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sell_only_by_packaging/es/
This test was relying on the fact that it was being tested along with `sale_packaging_default`. But there's no direct dependency between these modules. Besides, that assertion was never executed, so I removed it. @moduon MT-3930
Currently translated at 100.0% (15 of 15 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sell_only_by_packaging Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sell_only_by_packaging/it/
| templates._check_sell_only_by_packaging_can_be_sold_packaging_ids() | ||
| except exceptions.ValidationError as e: | ||
| raise exceptions.ValidationError( | ||
| _( |
There was a problem hiding this comment.
| _( | |
| self.env._( |
You can replace the call to translate a string (
_) withself.env._for getting some performance improvement in some cases. See odoo/odoo#174844.
| 'Packaging level "{}" must stay with "Can be sold",' | ||
| ' at least one product configured as "sell only' | ||
| ' by packaging" is using it.' | ||
| ).format(record.display_name) |
There was a problem hiding this comment.
please also get rid of the .format, see https://github.com/OCA/odoo-module-migrator/pull/114
(here and in other locations; also impact translations)
| def _compute_template_min_sellable_qty(self): | ||
| for record in self: | ||
| record.min_sellable_qty = 0.0 | ||
| if len(record.product_variant_ids) == 1: |
There was a problem hiding this comment.
| if len(record.product_variant_ids) == 1: | |
| if record.product_variant_count == 1: |
There was a problem hiding this comment.
What would we gain from triggering a compute method?
| for product in self: | ||
| if product.sell_only_by_packaging and not product.sale_ok: | ||
| raise ValidationError( | ||
| _( |
There was a problem hiding this comment.
| _( | |
| self.env._( |
same with all _( above code
| len(product.product_variant_ids) == 1 | ||
| and not any(pack.sales for pack in product.packaging_ids) | ||
| # Product variants condition | ||
| or len(product.product_variant_ids) > 1 |
There was a problem hiding this comment.
| len(product.product_variant_ids) == 1 | |
| and not any(pack.sales for pack in product.packaging_ids) | |
| # Product variants condition | |
| or len(product.product_variant_ids) > 1 | |
| product.product_variant_count == 1 | |
| and not any(pack.sales for pack in product.packaging_ids) | |
| # Product variants condition | |
| or product.product_variant_count > 1 |
There was a problem hiding this comment.
The code here seems to be mostly duplicated with the product_packaging_level_salable module, right?
https://github.com/trisdoan/product-attribute/blob/18.0-mig-product_packaging_level_salable/product_packaging_level_salable/tests/common.py
8c8e6b3 to
b52008d
Compare
b52008d to
3ccc34a
Compare
Note