-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP]sale_loyalty_ux: SOs on programs
- Loading branch information
Showing
7 changed files
with
30 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
from . import loyalty_rule | ||
from . import sale_order | ||
from . import loyalty_program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import ast | ||
|
||
from odoo import fields, models | ||
from odoo.osv import expression | ||
|
||
|
||
class LoyaltyProgram(models.Model): | ||
_inherit = 'loyalty.program' | ||
|
||
def _get_valid_pricelists(self, pricelist): | ||
''' | ||
Returns a dict containing the pricelists that match per rule of the program | ||
''' | ||
rule_pricelists = dict() | ||
for rule in self.rule_ids: | ||
if not rule.pricelist_ids: | ||
rule_pricelists[rule] = pricelist | ||
else: | ||
rule_pricelists[rule] = rule.pricelist_ids | ||
return rule_pricelists | ||
sale_domain = fields.Char(default="[]") | ||
|
||
def _get_valid_sale_order(self): | ||
domain = [] | ||
if self.sale_domain and self.sale_domain != '[]': | ||
domain = expression.AND([domain, ast.literal_eval(self.sale_domain)]) | ||
return domain | ||
return False | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="loyalty_program_view_form" model="ir.ui.view"> | ||
<field name="name">loyalty.program.view.form</field> | ||
<field name="model">loyalty.program</field> | ||
<field name="inherit_id" ref="loyalty.loyalty_program_view_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="date_to" position="after"> | ||
<field name="sale_domain" string="Sales domain" widget="domain" options="{'model': 'sale.order', 'in_dialog': true}"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
This file was deleted.
Oops, something went wrong.