Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions l10n_it_vat_registries/account_tax_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class AccountTaxRegistry(models.Model):
'res.company', 'Company', required=True,
default=lambda self: self.env['res.company']._company_default_get(
'account.tax.registry'))
order = fields.Selection([
('date_name', 'Date - Number'),
('journal_date_name', 'Journal - Date - Number'),
], 'Order Moves')
journal_ids = fields.One2many(
'account.journal', 'tax_registry_id', 'Journals', readonly=True)
type = fields.Selection([
Expand Down
1 change: 1 addition & 0 deletions l10n_it_vat_registries/account_tax_registry_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<group>
<field name="name"></field>
<field name="type"></field>
<field name="order"></field>
</group>
<separator string="Journals"></separator>
<field name="journal_ids"></field>
Expand Down
1 change: 1 addition & 0 deletions l10n_it_vat_registries/vat_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def set_context(self, objects, data, ids, report_type=None):
self.localcontext.update({
'registry_type': data['form'].get('registry_type'),
'only_totals': data['form'].get('only_totals'),
'order': data['form'].get('order'),
'tax_registry_name': data['form'].get('tax_registry_name'),
'l10n_it_count_fiscal_page_base': data['form'].get(
'fiscal_page_base'),
Expand Down
14 changes: 14 additions & 0 deletions l10n_it_vat_registries/views/report_registro_iva.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,24 @@
</thead>

<t t-set="counter" t-value="0"/>
<t t-set="sv_journal_id" t-value="False"/>
<tbody>
<t t-foreach="get_move(data['ids'])" t-as="move">
<t t-set="counter" t-value="counter + 1"/>
<t t-foreach="tax_lines(move)" t-as="line">

<t t-if="order == 'journal_date_name'">
<t t-if="move.journal_id.id != sv_journal_id">
<tr>
<td colspan='9'>
<h3 style="page-break-inside: avoid;border-top:1px solid;border-bottom:1px solid;"
t-esc="move.journal_id.name"/>
</td>
</tr>
</t>
</t>
<t t-set="sv_journal_id" t-value="move.journal_id.id"/>

<t t-if="print_details > 0 ">
<t t-set="line_class_left" t-value="left_without_line"/>
<t t-set="line_class_right" t-value="right_without_line"/>
Expand Down
16 changes: 14 additions & 2 deletions l10n_it_vat_registries/wizard/print_registro_iva.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def _get_period(self):
], 'Layout', required=True,
default='customer')
tax_registry_id = fields.Many2one('account.tax.registry', 'VAT registry')
order = fields.Selection([
('date_name', 'Date - Number'),
('journal_date_name', 'Journal - Date - Number'),
], 'Order Moves')
journal_ids = fields.Many2many(
'account.journal',
'registro_iva_journals_rel',
Expand All @@ -75,6 +79,7 @@ def _get_period(self):
def on_change_vat_registry(self):
self.journal_ids = self.tax_registry_id.journal_ids
self.type = self.tax_registry_id.type
self.order = self.tax_registry_id.order
if self.type:
if self.type == 'supplier':
self.tax_sign = -1
Expand All @@ -84,11 +89,17 @@ def on_change_vat_registry(self):
def print_registro(self, cr, uid, ids, context=None):
wizard = self.browse(cr, uid, ids[0], context=context)
move_obj = self.pool['account.move']
move_ids = move_obj.search(cr, uid, [
domain = [
('journal_id', 'in', [j.id for j in wizard.journal_ids]),
('period_id', 'in', [p.id for p in wizard.period_ids]),
('state', '=', 'posted'),
], order='date, name')
]
if wizard.order == 'journal_date_name':
move_ids = move_obj.search(
cr, uid, domain, order='journal_id, date, name')
else:
move_ids = move_obj.search(
cr, uid, domain, order='date, name')
if not move_ids:
raise UserError(_('No documents found in the current selection'))
datas = {}
Expand All @@ -103,6 +114,7 @@ def print_registro(self, cr, uid, ids, context=None):
else:
datas_form['tax_registry_name'] = ''
datas_form['only_totals'] = wizard.only_totals
datas_form['order'] = wizard.order
report_name = 'l10n_it_vat_registries.report_registro_iva'
datas = {
'ids': move_ids,
Expand Down
1 change: 1 addition & 0 deletions l10n_it_vat_registries/wizard/print_registro_iva.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<field name="period_ids" colspan="4" nolabel="1" height="250"/>
<separator string="Journals" colspan="4"/>
<field name="tax_registry_id"></field>
<field name="order"></field>
<field name="journal_ids" colspan="4" nolabel="1" height="250" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"/>
<separator string="Layout" colspan="4"/>
<field name="type"/>
Expand Down