mirror of
https://github.com/NaN-tic/trytond-account_invoice_company_currency-deprecated.git
synced 2023-12-14 05:33:10 +01:00
Update to 4.7
This commit is contained in:
parent
6b72d6077b
commit
0ea05e87e0
|
@ -1,7 +1,8 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the full
|
# The COPYRIGHT file at the top level of this repository contains the full
|
||||||
# copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
import invoice
|
from . import invoice
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
|
|
12
invoice.py
12
invoice.py
|
@ -60,8 +60,8 @@ class Invoice:
|
||||||
|
|
||||||
@fields.depends('company', 'currency')
|
@fields.depends('company', 'currency')
|
||||||
def on_change_with_different_currencies(self, name=None):
|
def on_change_with_different_currencies(self, name=None):
|
||||||
if self.company and self.company.currency and self.currency:
|
if self.company:
|
||||||
return self.company.currency.id != self.currency.id
|
return self.company.currency != self.currency
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@fields.depends('company')
|
@fields.depends('company')
|
||||||
|
@ -125,7 +125,8 @@ class Invoice:
|
||||||
|
|
||||||
class InvoiceTax:
|
class InvoiceTax:
|
||||||
__name__ = 'account.invoice.tax'
|
__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')
|
'get_company_currency_digits')
|
||||||
company_base = fields.Function(fields.Numeric('Base (Company Currency)',
|
company_base = fields.Function(fields.Numeric('Base (Company Currency)',
|
||||||
digits=(16, Eval('_parent_invoice',
|
digits=(16, Eval('_parent_invoice',
|
||||||
|
@ -169,13 +170,14 @@ class InvoiceLine():
|
||||||
__metaclass__ = PoolMeta
|
__metaclass__ = PoolMeta
|
||||||
__name__ = 'account.invoice.line'
|
__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')
|
'get_company_currency_digits')
|
||||||
company_amount = fields.Function(
|
company_amount = fields.Function(
|
||||||
fields.Numeric('Amount (Company Currency)',
|
fields.Numeric('Amount (Company Currency)',
|
||||||
digits=(16, Eval('_parent_invoice', {}).get(
|
digits=(16, Eval('_parent_invoice', {}).get(
|
||||||
'company_currency_digits',
|
'company_currency_digits',
|
||||||
Eval('company_currency_digits',2))),
|
Eval('company_currency_digits', 2))),
|
||||||
depends=['company_currency_digits']), 'get_company_amount')
|
depends=['company_currency_digits']), 'get_company_amount')
|
||||||
|
|
||||||
def get_company_currency_digits(self, name):
|
def get_company_currency_digits(self, name):
|
||||||
|
|
|
@ -9,6 +9,7 @@ Imports::
|
||||||
>>> from decimal import Decimal
|
>>> from decimal import Decimal
|
||||||
>>> from operator import attrgetter
|
>>> from operator import attrgetter
|
||||||
>>> from proteus import config, Model, Wizard
|
>>> from proteus import config, Model, Wizard
|
||||||
|
>>> from trytond.tests.tools import activate_modules
|
||||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||||
... get_company
|
... get_company
|
||||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||||
|
@ -17,18 +18,9 @@ Imports::
|
||||||
... set_fiscalyear_invoice_sequences, create_payment_term
|
... set_fiscalyear_invoice_sequences, create_payment_term
|
||||||
>>> today = datetime.date.today()
|
>>> today = datetime.date.today()
|
||||||
|
|
||||||
Create database::
|
|
||||||
|
|
||||||
>>> config = config.set_trytond()
|
|
||||||
>>> config.pool.test = True
|
|
||||||
|
|
||||||
Install account_invoice_company_currency::
|
Install account_invoice_company_currency::
|
||||||
|
|
||||||
>>> Module = Model.get('ir.module')
|
>>> config = activate_modules('account_invoice_company_currency')
|
||||||
>>> module, = Module.find(
|
|
||||||
... [('name', '=', 'account_invoice_company_currency')])
|
|
||||||
>>> module.click('install')
|
|
||||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
|
||||||
|
|
||||||
Create company::
|
Create company::
|
||||||
|
|
||||||
|
@ -37,8 +29,7 @@ Create company::
|
||||||
>>> currencies = Currency.find([('code', '=', 'EUR')])
|
>>> currencies = Currency.find([('code', '=', 'EUR')])
|
||||||
>>> if not currencies:
|
>>> if not currencies:
|
||||||
... eur = Currency(name='Euro', symbol=u'€', code='EUR',
|
... eur = Currency(name='Euro', symbol=u'€', code='EUR',
|
||||||
... rounding=Decimal('0.01'), mon_grouping='[]',
|
... rounding=Decimal('0.01'))
|
||||||
... mon_decimal_point='.')
|
|
||||||
... eur.save()
|
... eur.save()
|
||||||
... CurrencyRate(date=today + relativedelta(month=1, day=1),
|
... CurrencyRate(date=today + relativedelta(month=1, day=1),
|
||||||
... rate=Decimal('2.0'), currency=eur).save()
|
... rate=Decimal('2.0'), currency=eur).save()
|
||||||
|
@ -85,20 +76,16 @@ Create product::
|
||||||
>>> ProductUom = Model.get('product.uom')
|
>>> ProductUom = Model.get('product.uom')
|
||||||
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
||||||
>>> ProductTemplate = Model.get('product.template')
|
>>> ProductTemplate = Model.get('product.template')
|
||||||
>>> Product = Model.get('product.product')
|
|
||||||
>>> product = Product()
|
|
||||||
>>> template = ProductTemplate()
|
>>> template = ProductTemplate()
|
||||||
>>> template.name = 'product'
|
>>> template.name = 'product'
|
||||||
>>> template.default_uom = unit
|
>>> template.default_uom = unit
|
||||||
>>> template.type = 'service'
|
>>> template.type = 'service'
|
||||||
>>> template.list_price = Decimal('40')
|
>>> template.list_price = Decimal('40')
|
||||||
>>> template.cost_price = Decimal('25')
|
|
||||||
>>> template.account_expense = expense
|
>>> template.account_expense = expense
|
||||||
>>> template.account_revenue = revenue
|
>>> template.account_revenue = revenue
|
||||||
>>> template.customer_taxes.append(tax)
|
>>> template.customer_taxes.append(tax)
|
||||||
>>> template.save()
|
>>> template.save()
|
||||||
>>> product.template = template
|
>>> product, = template.products
|
||||||
>>> product.save()
|
|
||||||
|
|
||||||
Create payment term::
|
Create payment term::
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=4.1.0
|
version=4.7.0
|
||||||
depends:
|
depends:
|
||||||
account_invoice
|
account_invoice
|
||||||
xml:
|
xml:
|
||||||
|
|
Loading…
Reference in a new issue