Skip to content

Commit

Permalink
[ADD] sale_commission_product_criteria_domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 14, 2023
1 parent 42b74fe commit 055500e
Show file tree
Hide file tree
Showing 20 changed files with 989 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_commission_items(self, commission, product):
AND (item.commission_id = %s)
AND (item.active = TRUE)
ORDER BY
item.applied_on, categ.complete_name desc, item.id desc
item.applied_on, categ.complete_name desc
""",
(
product.product_tmpl_id.ids,
Expand Down
1 change: 0 additions & 1 deletion sale_commission_product_criteria/views/views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
name="commission_id"
invisible="context.get('hide_commission_id')"
options="{'no_create': True, 'no_open': 1}"
domain="[('commission_type', '=', 'product')]"
/>
<field name="applied_on" widget="radio" />
<field name="based_on" invisible="1" />
Expand Down
Empty file.
1 change: 1 addition & 0 deletions sale_commission_product_criteria_domain/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions sale_commission_product_criteria_domain/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# © 2023 ooops404
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Sale Commission Product Criteria Domain",
"version": "14.0.1.0.0",
"author": "Ilyas," "Ooops404," "Odoo Community Association (OCA)",
"contributors": ["Ilyas"],
"maintainers": ["ilyasProgrammer"],
"website": "https://github.com/OCA/commission",
"category": "Sales Management",
"license": "AGPL-3",
"depends": [
"sale_commission_product_criteria_discount",
"web_domain_field",
],
"demo": [
"demo/demo_data.xml",
],
"data": [
"views/views.xml",
"security/ir.model.access.csv",
],
"application": False,
"installable": True,
"auto_install": False,
}
154 changes: 154 additions & 0 deletions sale_commission_product_criteria_domain/demo/demo_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" ?>
<odoo>
<!-- Commissions -->
<record id="demo_commission_rules_restrict" model="sale.commission">
<field name="name">Based on Rules Restricted</field>
<field name="commission_type">product_restricted</field>
</record>

<!-- Commission Groups -->
<record id="demo_cig_spain" model="commission.items.group">
<field name="name">Spain</field>
<field
name="commission_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_commission_rules_restrict')])]"
/>
</record>

<record id="demo_cig_italy" model="commission.items.group">
<field name="name">Italy</field>
<field
name="commission_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_commission_rules_restrict')])]"
/>
</record>

<!-- Commission Items -->
<record id="demo_crr_item_1" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="1" />
<field name="based_on">sol</field>
<field name="applied_on">3_global</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">10</field>
<field name="group_id" ref="demo_cig_italy" />
</record>

<record id="demo_crr_item_2" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="2" />
<field name="based_on">sol</field>
<field name="applied_on">2_product_category</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">20</field>
<field name="categ_id" ref="product.product_category_5" />
<field name="group_id" ref="demo_cig_spain" />
</record>

<record id="demo_crr_item_3" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="3" />
<field name="based_on">sol</field>
<field name="applied_on">1_product</field>
<field name="commission_type">percentage</field>
<field name="percent_amount">5</field>
<field
name="product_tmpl_id"
ref="product.product_product_4_product_template"
/>
<field name="group_id" ref="demo_cig_spain" />
</record>

<record id="demo_crr_item_4" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="4" />
<field name="based_on">sol</field>
<field name="applied_on">0_product_variant</field>
<field name="commission_type">percentage</field>
<field name="percent_amount">15</field>
<field name="product_id" ref="product.product_product_4" />
<field name="group_id" ref="demo_cig_spain" />
</record>

<record id="demo_crr_item_5_disc" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="1" />
<field name="based_on">discount</field>
<field name="applied_on">1_product</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">7.50</field>
<field name="discount_from">10.01</field>
<field name="discount_to">100</field>
<field
name="product_tmpl_id"
ref="product.product_product_11_product_template"
/>
<field name="group_id" ref="demo_cig_italy" />
</record>

<record id="demo_crr_item_6_disc" model="commission.item">
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field name="sequence" eval="2" />
<field name="based_on">discount</field>
<field name="applied_on">1_product</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">15</field>
<field name="discount_from">0</field>
<field name="discount_to">10</field>
<field
name="product_tmpl_id"
ref="product.product_product_1_product_template"
/>
<field name="group_id" ref="demo_cig_spain" />
</record>

<!-- Agents -->
<record id="demo_agent_rules_restricted" model="res.partner">
<field name="name">Agent Rules Restricted</field>
<field name="is_company">True</field>
<field name="agent">True</field>
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field
name="allowed_commission_group_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_cig_italy')])]"
/>
</record>

<!-- Azure -->
<record id="base.res_partner_12" model="res.partner">
<field name="apply_commission_restrictions" eval="True" />
<field
name="agent_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_agent_rules_restricted')])]"
/>
</record>
<record id="cia_azure" model="commission.item.agent">
<field name="partner_id" ref="base.res_partner_12" />
<field
name="group_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_cig_spain')])]"
/>
<field name="agent_id" ref="demo_agent_rules_restricted" />
</record>

<!-- Deco -->
<record id="base.res_partner_2" model="res.partner">
<field name="apply_commission_restrictions" eval="True" />
<field
name="agent_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_agent_rules_restricted')])]"
/>
</record>
<record id="cia_deco" model="commission.item.agent">
<field name="partner_id" ref="base.res_partner_2" />
<field
name="group_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_cig_italy')])]"
/>
<field
name="agent_id"
ref="sale_commission_product_criteria_domain.demo_agent_rules_restricted"
/>
</record>

</odoo>
3 changes: 3 additions & 0 deletions sale_commission_product_criteria_domain/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import commission
from . import commission_group
from . import partner
Loading

0 comments on commit 055500e

Please sign in to comment.