Skip to content
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

[ADD]product_configurator_mrp_quantity #122

Open
wants to merge 17 commits into
base: 17.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[IMP]IMP COde.
Vandan-OSI committed Oct 15, 2024
commit 40661d1afc3de8798c35cfb9996dab10919f6255
35 changes: 18 additions & 17 deletions product_configurator_mrp_quantity/models/product_attribute.py
Original file line number Diff line number Diff line change
@@ -124,22 +124,23 @@ def _check_default_qty_maximum_qty(self):

def write(self, values):
result = super().write(values)
if self.is_qty_required and (
values.get("default_qty") or values.get("maximum_qty")
):
qty_list = []
attribute_value_qty_obj = self.env["attribute.value.qty"]
for i in range(self.default_qty, self.maximum_qty + 1):
qty_list.append(
{
"product_tmpl_id": self.product_tmpl_id.id,
"product_attribute_id": self.attribute_id.id,
"product_attribute_value_id": self.product_attribute_value_id.id,
"qty": i,
"template_attri_value_id": self.id,
}
)
self.attribute_value_qty_ids.unlink()
attribute_value_qty_obj.create(qty_list)
attribute_value_qty_obj = self.env["attribute.value.qty"]
for rec in self:
if rec.is_qty_required and (
values.get("default_qty") or values.get("maximum_qty")
):
qty_list = []
for i in range(rec.default_qty, rec.maximum_qty + 1):
qty_list.append(
{
"product_tmpl_id": rec.product_tmpl_id.id,
"product_attribute_id": rec.attribute_id.id,
"product_attribute_value_id": rec.product_attribute_value_id.id,
"qty": i,
"template_attri_value_id": rec.id,
}
)
rec.attribute_value_qty_ids.unlink()
attribute_value_qty_obj.create(qty_list)

return result