Update to 4.7

This commit is contained in:
C?dric Krier 2017-12-12 13:22:31 +01:00
parent bca0d0769d
commit a18aeceaaf
10 changed files with 1183 additions and 20 deletions

View File

@ -9,4 +9,4 @@ include view/*.xml
include locale/*.po
include doc/*
include tests/*.rst
include *.odt
include *.fodt

View File

@ -1,10 +1,10 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import Pool
from .invoice import *
from . import invoice
def register():
Pool.register(
InvoiceLine,
invoice.InvoiceLine,
module='account_invoice_discount', type_='model')

1157
invoice.fodt Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -33,13 +33,9 @@ class InvoiceLine:
super(InvoiceLine, cls).__setup__()
cls.unit_price.states['readonly'] = True
cls.unit_price.digits = (20, price_digits[1] + discount_digits[1])
if 'discount' not in cls.amount.on_change_with:
cls.amount.on_change_with.add('discount')
if 'gross_unit_price' not in cls.amount.on_change_with:
cls.amount.on_change_with.add('gross_unit_price')
@staticmethod
def default_discount():
@classmethod
def default_discount(cls):
return Decimal(0)
def update_prices(self):
@ -78,6 +74,10 @@ class InvoiceLine:
def on_change_discount(self):
return self.update_prices()
@fields.depends('discount', 'gross_unit_price')
def on_change_with_amount(self):
return super(InvoiceLine, self).on_change_with_amount()
@fields.depends('gross_unit_price', 'unit_price', 'discount')
def on_change_product(self):
super(InvoiceLine, self).on_change_product()

View File

@ -15,10 +15,20 @@
</record>
<record model="ir.action.report" id="account_invoice.report_invoice">
<field name="active" eval="False"/>
</record>
<record model="ir.action.report" id="report_invoice">
<field name="name">Invoice</field>
<field name="model">account.invoice</field>
<field name="report_name">account.invoice</field>
<field name="report">account_invoice_discount/invoice.odt</field>
<field name="report">account_invoice_discount/invoice.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_invoice_keyword">
<field name="keyword">form_print</field>
<field name="model">account.invoice,-1</field>
<field name="action" ref="report_invoice"/>
</record>
</data>
</tryton>

View File

@ -73,7 +73,7 @@ setup(name=name,
],
package_data={
'trytond.modules.account_invoice_discount': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.odt',
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']),
},
classifiers=[

View File

@ -63,20 +63,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('20')
>>> template.cost_price = Decimal('12')
>>> 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::
@ -179,7 +175,7 @@ Post invoice and check again invoice totals and taxes::
>>> credit_note_tax_code.sum
Decimal('0.00')
Discounts are copyied when crediting the invoice::
Discounts are copied when crediting the invoice::
>>> credit = Wizard('account.invoice.credit', [invoice])
>>> credit.form.with_refund = True

View File

@ -1,10 +1,10 @@
[tox]
envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py27,py33,py34,py35}-postgresql: psycopg2 >= 2.5
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
mysql: MySQL-python
sqlite: sqlitebck

View File

@ -1,5 +1,5 @@
[tryton]
version=4.3.0
version=4.7.0
depends:
ir
account_invoice