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

[16.0][IMP] product_set: Merge with sale_product_set_layout #1452

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions product_set/demo/product_set_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
<field name="product_id" ref="product.product_product_1" />
<field name="quantity">1</field>
</record>
<record id="product_set_line_services_3" model="product.set.line">
<field name="product_set_id" ref="product_set_services" />
<field name="display_type">line_section</field>
<field name="name">Section</field>
</record>
</odoo>
10 changes: 9 additions & 1 deletion product_set/models/product_set_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ class ProductSetLine(models.Model):
_rec_name = "product_id"
_order = "product_set_id, sequence, product_id"

display_type = fields.Selection(
[
("line_section", "Section"),
("line_note", "Note"),
]
)

product_id = fields.Many2one(
comodel_name="product.product",
domain=[("sale_ok", "=", True)],
string="Product",
required=True,
required=False,
)
quantity = fields.Float(
digits="Product Unit of Measure", required=True, default=1.0
Expand All @@ -27,3 +34,4 @@ class ProductSetLine(models.Model):
company_id = fields.Many2one(
"res.company", related="product_set_id.company_id", store=True, readonly=True
)
name = fields.Char()
30 changes: 28 additions & 2 deletions product_set/views/product_set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,37 @@
/>
</group>
<label for="set_line_ids" />
<field name="set_line_ids" nolabel="1">
<field
name="set_line_ids"
nolabel="1"
widget="section_and_note_one2many"
>
<tree editable="top">
<field name="sequence" widget="handle" />
<field name="product_id" />
<field
name="product_id"
attrs="{'required': [('display_type', '=', False)]}"
/>
<field name="quantity" />
<field name="display_type" invisible="1" />
<field name="name" widget="section_and_note_text" />
<control>
<create
name="add_line_control"
string="Add a line"
/>
<create
name="add_section_control"
string="Add a section"
context="{'default_display_type': 'line_section'}"
/>
<create
name="add_note_control"
string="Add a note"
context="{'default_display_type': 'line_note'}"
/>
</control>

</tree>
</field>
</group>
Expand Down
Loading