Update to 4.7
This commit is contained in:
parent
bca0d0769d
commit
a18aeceaaf
|
@ -9,4 +9,4 @@ include view/*.xml
|
|||
include locale/*.po
|
||||
include doc/*
|
||||
include tests/*.rst
|
||||
include *.odt
|
||||
include *.fodt
|
||||
|
|
|
@ -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')
|
||||
|
|
File diff suppressed because it is too large
Load Diff
BIN
invoice.odt
BIN
invoice.odt
Binary file not shown.
12
invoice.py
12
invoice.py
|
@ -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()
|
||||
|
|
12
invoice.xml
12
invoice.xml
|
@ -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>
|
||||
|
|
2
setup.py
2
setup.py
|
@ -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=[
|
||||
|
|
|
@ -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
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=4.3.0
|
||||
version=4.7.0
|
||||
depends:
|
||||
ir
|
||||
account_invoice
|
||||
|
|
Loading…
Reference in New Issue