Update to 4.7

This commit is contained in:
C?dric Krier 2017-12-12 11:09:23 +01:00
parent 6b72d6077b
commit 0ea05e87e0
4 changed files with 14 additions and 24 deletions

View file

@ -1,7 +1,8 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import Pool
import invoice
from . import invoice
def register():
Pool.register(

View file

@ -60,8 +60,8 @@ class Invoice:
@fields.depends('company', 'currency')
def on_change_with_different_currencies(self, name=None):
if self.company and self.company.currency and self.currency:
return self.company.currency.id != self.currency.id
if self.company:
return self.company.currency != self.currency
return False
@fields.depends('company')
@ -125,7 +125,8 @@ class Invoice:
class InvoiceTax:
__name__ = 'account.invoice.tax'
company_currency_digits = fields.Function(fields.Integer('Currency Digits'),
company_currency_digits = fields.Function(
fields.Integer('Currency Digits'),
'get_company_currency_digits')
company_base = fields.Function(fields.Numeric('Base (Company Currency)',
digits=(16, Eval('_parent_invoice',
@ -169,13 +170,14 @@ class InvoiceLine():
__metaclass__ = PoolMeta
__name__ = 'account.invoice.line'
company_currency_digits = fields.Function(fields.Integer('Currency Digits'),
company_currency_digits = fields.Function(
fields.Integer('Currency Digits'),
'get_company_currency_digits')
company_amount = fields.Function(
fields.Numeric('Amount (Company Currency)',
digits=(16, Eval('_parent_invoice', {}).get(
'company_currency_digits',
Eval('company_currency_digits',2))),
Eval('company_currency_digits', 2))),
depends=['company_currency_digits']), 'get_company_amount')
def get_company_currency_digits(self, name):

View file

@ -9,6 +9,7 @@ Imports::
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> 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_fiscalyear, \
@ -17,18 +18,9 @@ Imports::
... set_fiscalyear_invoice_sequences, create_payment_term
>>> today = datetime.date.today()
Create database::
>>> config = config.set_trytond()
>>> config.pool.test = True
Install account_invoice_company_currency::
>>> Module = Model.get('ir.module')
>>> module, = Module.find(
... [('name', '=', 'account_invoice_company_currency')])
>>> module.click('install')
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
>>> config = activate_modules('account_invoice_company_currency')
Create company::
@ -37,8 +29,7 @@ Create company::
>>> currencies = Currency.find([('code', '=', 'EUR')])
>>> if not currencies:
... eur = Currency(name='Euro', symbol=u'€', code='EUR',
... rounding=Decimal('0.01'), mon_grouping='[]',
... mon_decimal_point='.')
... rounding=Decimal('0.01'))
... eur.save()
... CurrencyRate(date=today + relativedelta(month=1, day=1),
... rate=Decimal('2.0'), currency=eur).save()
@ -85,20 +76,16 @@ Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> Product = Model.get('product.product')
>>> product = Product()
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.cost_price = Decimal('25')
>>> template.account_expense = expense
>>> template.account_revenue = revenue
>>> template.customer_taxes.append(tax)
>>> template.save()
>>> product.template = template
>>> product.save()
>>> product, = template.products
Create payment term::

View file

@ -1,5 +1,5 @@
[tryton]
version=4.1.0
version=4.7.0
depends:
account_invoice
xml: