Skip to content

Commit

Permalink
x[IMP] website_sale_cancel_not_show: Improve domain
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis authored and anajuaristi committed Oct 15, 2024
1 parent 65a5b1d commit aeb15ff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions website_sale_cancel_not_show/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "AGPL-3",
"depends": ["website_sale", "sale", "portal"],
"data": [
"views/ir_rule.xml",
"views/website_sale_my_account_state_templates.xml",
],
"installable": True,
Expand Down
10 changes: 8 additions & 2 deletions website_sale_cancel_not_show/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ def _prepare_home_portal_values(self, counters):

def _prepare_quotations_domain(self, partner):
domain = [
("message_partner_ids", "child_of", [partner.commercial_partner_id.id]),
"&",
("state", "in", ["sent", "draft"]),
"|",
("message_partner_ids", "child_of", [partner.commercial_partner_id.id]),
("partner_id", "child_of", [partner.commercial_partner_id.id]),
]
return domain

def _prepare_orders_domain(self, partner):
domain = [
("message_partner_ids", "child_of", [partner.commercial_partner_id.id]),
"&",
("state", "in", ["sale"]),
"|",
("message_partner_ids", "child_of", [partner.commercial_partner_id.id]),
("partner_id", "child_of", [partner.commercial_partner_id.id]),
]
return domain

Expand Down
14 changes: 14 additions & 0 deletions website_sale_cancel_not_show/views/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="portal_partner_quotations_sales_orders_rule" model="ir.rule">
<field name="name">Portal Partner Quotations/Sales Orders Rule</field>
<field name="model_id" ref="sale.model_sale_order" />
<field name="perm_read">1</field>
<field name="perm_write">1</field>
<field name="perm_create">0</field>
<field name="perm_unlink">1</field>
<field
name="domain_force"
>[('partner_id','child_of', [user.commercial_partner_id.id])]</field>
</record>
</odoo>

0 comments on commit aeb15ff

Please sign in to comment.