[18.0][ADD] product_packaging_template: New module. Allow to configure packaging at product.template level#2133
Conversation
8443314 to
4eeb34f
Compare
| has 25 variants, and all of them are sold in the same packaging, one must define all the product.packaging | ||
| one by one on the variants. | ||
|
|
||
| The aim of this module is to be able to define the product.packaging at template level. |
There was a problem hiding this comment.
Maybe it is not convenient to use technical names here.
acsonefho
left a comment
There was a problem hiding this comment.
Minor changes!
Good job 💪
| <field name="category_id" ref="base.module_category_hidden" /> | ||
| <field | ||
| name="implied_ids" | ||
| eval="[(6, 0, [ref('product.group_stock_packaging')])]" |
There was a problem hiding this comment.
Command.xx(...)
(same for next line)
| "attribute_id": cls.attribute_color.id, | ||
| "value_ids": [ | ||
| ( | ||
| 6, |
There was a problem hiding this comment.
Same here with Command.xxx(...) (many times in this test file).
| Propagate changes on packages at variant level. | ||
| """ | ||
| res = super().write(vals) | ||
| values_to_propagate = { |
There was a problem hiding this comment.
Maybe extract these following lines into a dedicated function (that could help for project's modules).
def write(self, vals):
...
self._propagate_to_packagings(vals)
...
...
def _propagate_to_packagings(self, vals):
values_to_propagate = {
key: vals[key] for key in {"name", "sequence", "qty"} if key in vals
}
if values_to_propagate:
self.mapped("packaging_ids").write(values_to_propagate)
4eeb34f to
b61eb8a
Compare
7cc1885 to
40c75d2
Compare
…duct.template level
40c75d2 to
542fa3c
Compare
|
This PR has the |
|
/ocabot merge nobump |
|
On my way to merge this fine PR! |
|
@yvaucher your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-2133-by-yvaucher-bump-nobump. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
Product packaging are defined at product variant level. It means that if
a product template has 25 variants, and all of them are sold in the same
packaging, one must define all the product.packaging one by one on the
variants.
The aim of this module is to be able to define the product.packaging at
template level. It will then create the product.packaging on all
variants automatically.