Skip to content

Commit

Permalink
[MIG] product_pricelist_direct_print: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
therbin200 committed Nov 26, 2024
1 parent 558a98c commit 5e6a366
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
Binary file added pandoc-3.5-1-amd64.deb
Binary file not shown.
2 changes: 1 addition & 1 deletion product_pricelist_direct_print/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Product Pricelist Direct Print",
"summary": "Print price list from menu option, product templates, "
"products variants or price lists",
"version": "16.0.1.2.0",
"version": "17.0.1.0.0",
"category": "Product",
"website": "https://github.com/OCA/product-attribute",
"author": "Tecnativa, GRAP, Odoo Community Association (OCA)",
Expand Down
3 changes: 1 addition & 2 deletions product_pricelist_direct_print/data/mail_template_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
ref="product_pricelist_direct_print.model_product_pricelist_print"
/>
<field name="auto_delete" eval="True" />
<field name="report_template" ref="action_report_product_pricelist" />
<field name="report_name">{{ object.pricelist_id.name }}</field>
<field name="report_template_ids" eval="[(4, ref('product_pricelist_direct_print.action_report_product_pricelist'))]"/>
<field
name="lang"
>{{ object.partner_id and object.partner_id.lang or object.write_uid.partner_id.lang }}</field>
Expand Down
3 changes: 3 additions & 0 deletions product_pricelist_direct_print/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions product_pricelist_direct_print/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@

* Tris Doan
* Chau Le

* `Apik <https://apik.cloud/>`_:

* Thomas Herbin
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def _lang_get(self):

class ProductPricelistPrint(models.TransientModel):
_name = "product.pricelist.print"
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Product Pricelist Print"

context_active_model = fields.Char(
Expand Down Expand Up @@ -219,7 +220,7 @@ def message_composer_action(self):
compose_form_id = self.env.ref("mail.email_compose_message_wizard_form").id
ctx = {

Check warning on line 221 in product_pricelist_direct_print/wizards/product_pricelist_print.py

View check run for this annotation

Codecov / codecov/patch

product_pricelist_direct_print/wizards/product_pricelist_print.py#L220-L221

Added lines #L220 - L221 were not covered by tests
"default_composition_mode": "comment",
"default_res_id": self.id,
"default_res_ids": self.ids,
"default_model": "product.pricelist.print",
"default_use_template": bool(template_id),
"default_template_id": template_id,
Expand Down Expand Up @@ -253,17 +254,13 @@ def force_pricelist_send(self):
.with_context(
default_composition_mode="mass_mail",
default_notify=True,
default_res_id=self.id,
default_res_ids=self.ids,
default_model="product.pricelist.print",
default_template_id=template_id,
active_ids=self.ids,
)
.create({})
)
values = composer._onchange_template_id(
template_id, "mass_mail", "product.pricelist.print", self.id
)["value"]
composer.write(values)
composer.action_send_mail()

@api.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
<field
name="pricelist_id"
options="{'no_create': True, 'no_create_edit': True}"
attrs="{
'invisible' : [('partner_count', '!=', 0)],
'required' : [('partner_count', '=', 0)],
}"
invisible="partner_count != 0"
required="partner_count == 0"
/>
<field name="date" />
<field name="lang" />
Expand All @@ -38,40 +36,40 @@
<field
name="categ_ids"
widget="many2many_tags"
attrs="{'invisible':['|',('product_tmpl_ids','!=',[]), ('product_ids','!=',[])]}"
inivisble="product_tmpl_ids or product_ids"
/>
<field
name="print_child_categories"
attrs="{'invisible':[('categ_ids','=',[])]}"
invisible="not categ_ids"
/>
<field name="show_only_defined_products" />
<field
name="show_variants"
attrs="{'invisible':[('last_ordered_products', '!=', 0)]}"
invisible="last_ordered_products != 0"
/>
<field
name="last_ordered_products"
attrs="{'invisible':[('partner_count','=',0)]}"
invisible="partner_count == 0"
/>
</group>
</group>
<notebook>
<page
string="Products"
attrs="{'invisible':['|', '|', ('categ_ids','!=',[]), ('last_ordered_products', '!=', 0), ('context_active_model', 'in', ['product.template','product.product'])]}"
invisible="categ_ids or last_ordered_products == 0 or context_active_model in ['product.template','product.product']"
>
<field
name="product_tmpl_ids"
nolabel="1"
attrs="{'invisible':[('show_variants','=',True)]}"
invisible="show_variants"
>
<tree>
<field name="name" />
</tree>
</field>
<field
name="product_ids"
attrs="{'invisible':[('show_variants','=',False)]}"
invisible="not show_variants"
>
<tree>
<field name="name" />
Expand All @@ -80,7 +78,7 @@
</page>
<page
string="Customers"
attrs="{'invisible':['|', ('pricelist_id', '!=', False), ('context_active_model', '=', 'res.partner')]}"
invisible="pricelist_id or context_active_model == 'res.partner'"
>
<field name="partner_ids" />
<field name="partner_count" invisible="1" />
Expand All @@ -95,14 +93,14 @@
string="Print"
type="object"
class="btn-primary"
attrs="{'invisible':[('partner_count', '>', 1)]}"
invisible="partner_count > 1"
/>
<button
name="action_pricelist_send"
string="Send by email"
type="object"
class="btn-primary"
attrs="{'invisible':[('pricelist_id','=',False), ('partner_count','=',0)]}"
invisible="not pricelist_id and partner_count == 0"
/>
<button string="Cancel" class="btn-default" special="cancel" />
</footer>
Expand Down

0 comments on commit 5e6a366

Please sign in to comment.