minor fix report cache and field payment method
This commit is contained in:
parent
e2386385fb
commit
068198b875
|
@ -68,6 +68,7 @@ def register():
|
|||
invoice.MovesInvoicesStart,
|
||||
product.PriceList,
|
||||
invoice.InvoiceUpdateStart,
|
||||
invoice.Report,
|
||||
sale.SaleUpdateStart,
|
||||
purchase.PurchaseUpdateStart,
|
||||
payment_term.PaymentTerm,
|
||||
|
|
18
account.py
18
account.py
|
@ -16,7 +16,7 @@ from trytond.pyson import Eval, Bool, PYSONEncoder
|
|||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.modules.account.account import BalanceSheetContext
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
from .exceptions import (BadOperationError, DontWriteAccountError)
|
||||
|
||||
_ZERO = Decimal('0.0')
|
||||
|
@ -1364,7 +1364,6 @@ class PartyWithholding(Report):
|
|||
|
||||
periods = Period.search(dom_periods, order=[('start_date', 'ASC')])
|
||||
period_ids = [p.id for p in periods]
|
||||
|
||||
if data['certificate_type'] is None:
|
||||
dom_taxes = []
|
||||
else:
|
||||
|
@ -1372,6 +1371,9 @@ class PartyWithholding(Report):
|
|||
taxes = Tax.search(dom_taxes)
|
||||
tax_ids = [t.id for t in taxes]
|
||||
|
||||
class Empty:
|
||||
pass
|
||||
|
||||
records = []
|
||||
for party in parties:
|
||||
invoice_taxes = InvoiceTax.search([
|
||||
|
@ -1382,13 +1384,13 @@ class PartyWithholding(Report):
|
|||
], order=[('create_date', 'ASC')])
|
||||
if not invoice_taxes:
|
||||
continue
|
||||
|
||||
group_taxes = {}
|
||||
for it in invoice_taxes:
|
||||
if not it.tax.certificate_type:
|
||||
continue
|
||||
if it.tax.certificate_type not in group_taxes.keys():
|
||||
group_taxes[it.tax.certificate_type] = {
|
||||
'tax_type': it.tax.certificate_type,
|
||||
'taxes_with': [],
|
||||
'total_amount': _ZERO,
|
||||
'total_untaxed': _ZERO,
|
||||
|
@ -1396,10 +1398,12 @@ class PartyWithholding(Report):
|
|||
group_taxes[it.tax.certificate_type]['taxes_with'].append(it)
|
||||
group_taxes[it.tax.certificate_type]['total_amount'] += (it.amount) * (-1)
|
||||
group_taxes[it.tax.certificate_type]['total_untaxed'] += it.base
|
||||
|
||||
setattr(party, 'group_taxes', group_taxes)
|
||||
records.append(party)
|
||||
|
||||
p = Empty()
|
||||
p.party = party
|
||||
setattr(p, 'group_taxes', group_taxes)
|
||||
records.append(p)
|
||||
if not records:
|
||||
raise UserError(gettext('account_col.msg_report_missing_information'))
|
||||
report_context['records'] = records
|
||||
report_context['fiscalyear'] = Fiscalyear(data['fiscalyear'])
|
||||
report_context['start_date'] = periods[0].start_date
|
||||
|
|
18
invoice.py
18
invoice.py
|
@ -5,7 +5,7 @@ from decimal import Decimal
|
|||
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import ModelView, ModelSQL, fields, dualmethod
|
||||
from trytond.pool import Pool
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition
|
||||
from trytond.transaction import Transaction
|
||||
|
@ -50,7 +50,7 @@ class Invoice(ModelSQL, ModelView):
|
|||
'readonly': Eval('state') != 'draft',
|
||||
'invisible': Eval('type') == 'in',
|
||||
})
|
||||
payment_method = fields.Char('Payment Method',
|
||||
payment_method = fields.Text('Payment Method',
|
||||
states={'readonly': Eval('state') != 'draft'},
|
||||
depends=['payment_term'],
|
||||
)
|
||||
|
@ -201,8 +201,6 @@ class Invoice(ModelSQL, ModelView):
|
|||
@classmethod
|
||||
def set_number(cls, invoices):
|
||||
pool = Pool()
|
||||
Sequence = pool.get('ir.sequence')
|
||||
SequenceStrict = pool.get('ir.sequence.strict')
|
||||
Authorization = pool.get('account.invoice.authorization')
|
||||
config = pool.get('account.configuration')(1)
|
||||
|
||||
|
@ -673,3 +671,15 @@ class InvoiceUpdate(Wizard):
|
|||
InvoiceTax.delete([itax])
|
||||
invoice.save()
|
||||
return 'end'
|
||||
|
||||
|
||||
class InvoiceReport(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
@classmethod
|
||||
def _execute(cls, records, header, data, action):
|
||||
# Ensure to restore original context
|
||||
# set_lang may modify it
|
||||
with Transaction().set_context(Transaction().context):
|
||||
report_context = cls.get_context(records, header, data)
|
||||
return cls.convert(action, cls.render(action, report_context))
|
||||
|
|
|
@ -41,12 +41,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="text">"Error %(s)"</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.message" id="msg_report_missing_information">
|
||||
<field name="text">Don't found information for generate report</field>
|
||||
</record>
|
||||
<!-- <record model="ir.message" id="msg_account_move_created">
|
||||
<field name="text">Move "%s" created in "%s" seconds</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_party_missing">
|
||||
<field name="text">Error missing party for account "%s" in move "%s"</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_not_moves_period">
|
||||
<field name="text">There is not moves in period</field>
|
||||
</record>
|
||||
|
|
Binary file not shown.
|
@ -37,7 +37,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="petty_cash"/>
|
||||
<field name="petty_cash"/>
|
||||
<label name="payment_method"/>
|
||||
<field name="payment_method"/>
|
||||
<field name="payment_method" yexpand="0" rowspan="2"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@name='description']" position="before">
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue