Update to 4.7
This commit is contained in:
parent
bca0d0769d
commit
a18aeceaaf
|
@ -9,4 +9,4 @@ include view/*.xml
|
||||||
include locale/*.po
|
include locale/*.po
|
||||||
include doc/*
|
include doc/*
|
||||||
include tests/*.rst
|
include tests/*.rst
|
||||||
include *.odt
|
include *.fodt
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# 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
|
||||||
from .invoice import *
|
from . import invoice
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
InvoiceLine,
|
invoice.InvoiceLine,
|
||||||
module='account_invoice_discount', type_='model')
|
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__()
|
super(InvoiceLine, cls).__setup__()
|
||||||
cls.unit_price.states['readonly'] = True
|
cls.unit_price.states['readonly'] = True
|
||||||
cls.unit_price.digits = (20, price_digits[1] + discount_digits[1])
|
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
|
@classmethod
|
||||||
def default_discount():
|
def default_discount(cls):
|
||||||
return Decimal(0)
|
return Decimal(0)
|
||||||
|
|
||||||
def update_prices(self):
|
def update_prices(self):
|
||||||
|
@ -78,6 +74,10 @@ class InvoiceLine:
|
||||||
def on_change_discount(self):
|
def on_change_discount(self):
|
||||||
return self.update_prices()
|
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')
|
@fields.depends('gross_unit_price', 'unit_price', 'discount')
|
||||||
def on_change_product(self):
|
def on_change_product(self):
|
||||||
super(InvoiceLine, self).on_change_product()
|
super(InvoiceLine, self).on_change_product()
|
||||||
|
|
12
invoice.xml
12
invoice.xml
|
@ -15,10 +15,20 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.action.report" id="account_invoice.report_invoice">
|
<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="name">Invoice</field>
|
||||||
<field name="model">account.invoice</field>
|
<field name="model">account.invoice</field>
|
||||||
<field name="report_name">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>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -73,7 +73,7 @@ setup(name=name,
|
||||||
],
|
],
|
||||||
package_data={
|
package_data={
|
||||||
'trytond.modules.account_invoice_discount': (info.get('xml', [])
|
'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']),
|
'icons/*.svg', 'tests/*.rst']),
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|
|
@ -63,20 +63,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('20')
|
>>> template.list_price = Decimal('20')
|
||||||
>>> template.cost_price = Decimal('12')
|
|
||||||
>>> 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::
|
||||||
|
|
||||||
|
@ -179,7 +175,7 @@ Post invoice and check again invoice totals and taxes::
|
||||||
>>> credit_note_tax_code.sum
|
>>> credit_note_tax_code.sum
|
||||||
Decimal('0.00')
|
Decimal('0.00')
|
||||||
|
|
||||||
Discounts are copyied when crediting the invoice::
|
Discounts are copied when crediting the invoice::
|
||||||
|
|
||||||
>>> credit = Wizard('account.invoice.credit', [invoice])
|
>>> credit = Wizard('account.invoice.credit', [invoice])
|
||||||
>>> credit.form.with_refund = True
|
>>> credit.form.with_refund = True
|
||||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,10 +1,10 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
|
envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands = {envpython} setup.py test
|
commands = {envpython} setup.py test
|
||||||
deps =
|
deps =
|
||||||
{py27,py33,py34,py35}-postgresql: psycopg2 >= 2.5
|
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
|
||||||
pypy-postgresql: psycopg2cffi >= 2.5
|
pypy-postgresql: psycopg2cffi >= 2.5
|
||||||
mysql: MySQL-python
|
mysql: MySQL-python
|
||||||
sqlite: sqlitebck
|
sqlite: sqlitebck
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=4.3.0
|
version=4.7.0
|
||||||
depends:
|
depends:
|
||||||
ir
|
ir
|
||||||
account_invoice
|
account_invoice
|
||||||
|
|
Loading…
Reference in New Issue