FIX tests
This commit is contained in:
parent
34af9bce3b
commit
df48ea5e76
20
sale.py
20
sale.py
|
@ -243,15 +243,15 @@ class SaleRuleAction(ModelSQL, ModelView):
|
|||
'sale_forbidden': ('You cannot make this sale because of %s.'),
|
||||
})
|
||||
|
||||
@fields.depends('account')
|
||||
@fields.depends('rule')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
return self.rule.shop and self.rule.shop.currency.digits or 2
|
||||
return (self.rule and self.rule.shop and
|
||||
self.rule.shop.currency.digits or 2)
|
||||
|
||||
@fields.depends('rule')
|
||||
def on_change_action_type(self):
|
||||
if self.rule:
|
||||
self.currency_digits = (self.rule.shop
|
||||
and self.rule.shop.currency.digits or 2)
|
||||
self.currency_digits = (self.rule and self.rule.shop
|
||||
and self.rule.shop.currency.digits or 2)
|
||||
|
||||
def get_rec_name(self, name):
|
||||
for selection in self._fields['action_type'].selection:
|
||||
|
@ -344,15 +344,15 @@ class SaleRuleCondition(ModelSQL, ModelView):
|
|||
super(SaleRuleCondition, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
|
||||
@fields.depends('account')
|
||||
@fields.depends('rule')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
return self.rule.shop and self.rule.shop.currency.digits or 2
|
||||
return (self.rule and self.rule.shop and
|
||||
self.rule.shop.currency.digits or 2)
|
||||
|
||||
@fields.depends('rule')
|
||||
def on_change_criteria(self):
|
||||
if self.rule:
|
||||
self.currency_digits = (self.rule.shop
|
||||
and self.rule.shop.currency.digits or 2)
|
||||
self.currency_digits = (self.rule and self.rule.shop
|
||||
and self.rule.shop.currency.digits or 2)
|
||||
|
||||
@staticmethod
|
||||
def default_condition():
|
||||
|
|
10
sale.xml
10
sale.xml
|
@ -43,6 +43,16 @@ copyright notices and license terms. -->
|
|||
action="act_sale_rule"
|
||||
id="menu_sale_rule" icon="tryton-list"/>
|
||||
|
||||
<record model="ir.model.button" id="apply_rules_button">
|
||||
<field name="name">apply_rules</field>
|
||||
<field name="string">Apply Rules</field>
|
||||
<field name="model" search="[('model', '=', 'sale.sale')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="apply_rules_button_group_sale">
|
||||
<field name="button" ref="apply_rules_button"/>
|
||||
<field name="group" ref="sale.group_sale"/>
|
||||
</record>
|
||||
|
||||
<!-- sale.rule.condition -->
|
||||
<record model="ir.ui.view" id="sale_rule_condition_tree_view">
|
||||
<field name="model">sale.rule.condition</field>
|
||||
|
|
|
@ -7,6 +7,7 @@ Imports::
|
|||
>>> import datetime
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import config, Model, Wizard
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, \
|
||||
|
@ -14,19 +15,9 @@ Imports::
|
|||
>>> from trytond.modules.account_invoice.tests.tools import \
|
||||
... create_payment_term
|
||||
|
||||
Configure::
|
||||
|
||||
>>> config = config.set_trytond()
|
||||
>>> config.pool.test = True
|
||||
|
||||
Install sale_rule::
|
||||
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> module, = Module.find([
|
||||
... ('name', '=', 'sale_rule'),
|
||||
... ])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
>>> config = activate_modules('sale_rule')
|
||||
|
||||
Create company::
|
||||
|
||||
|
@ -63,13 +54,14 @@ Create products::
|
|||
>>> template.salable = True
|
||||
>>> template.lead_time = datetime.timedelta(0)
|
||||
>>> template.list_price = Decimal('20')
|
||||
>>> template.cost_price = Decimal('8')
|
||||
>>> template.account_revenue = revenue
|
||||
>>> template.save()
|
||||
>>> product1 = Product()
|
||||
>>> product1.template = template
|
||||
>>> product1.cost_price = Decimal('8')
|
||||
>>> product1.save()
|
||||
>>> product2 = Product()
|
||||
>>> product2.cost_price = Decimal('8')
|
||||
>>> product2.template = template
|
||||
>>> product2.save()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=4.1.0
|
||||
version=4.8.0
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
|
|
Loading…
Reference in New Issue