Browse Source

[IMP] add date_range_id on ledgers wizards

[FIX] restore partner ledger menuitem
pull/196/head
Damien Crier 9 years ago
committed by Leonardo Pistone
parent
commit
421b7f156e
  1. 5
      account_financial_report_qweb/__openerp__.py
  2. 6
      account_financial_report_qweb/menuitems.xml
  3. 2
      account_financial_report_qweb/wizard/general_ledger_wizard.xml
  4. 24
      account_financial_report_qweb/wizard/ledger_report_wizard.py
  5. 10
      account_financial_report_qweb/wizard/partner_ledger_wizard.xml

5
account_financial_report_qweb/__openerp__.py

@ -15,7 +15,7 @@
'website': 'http://www.camptocamp.com',
'depends': [
'account',
# 'date_range',
'date_range',
],
'data': [
'wizard/aged_partner_balance_wizard_view.xml',
@ -30,6 +30,9 @@
'reports.xml',
# 'wizard/partner_ledger_wizard.xml',
'report/templates/ledger_general.xml',
'wizard/partner_ledger_wizard.xml',
'menuitems.xml',
'reports.xml',
'report/templates/general_ledger.xml',
'report/templates/open_invoice_report.xml'
],

6
account_financial_report_qweb/menuitems.xml

@ -15,6 +15,12 @@
id="menu_ledger_report_wizard"
/>
<menuitem
parent="menu_oca_reports"
action="action_partner_ledger_report_wizard"
id="menu_partner_ledger_report_wizard"
/>
<menuitem
parent="menu_oca_reports"
id='account.menu_aged_partner_balance'

2
account_financial_report_qweb/wizard/general_ledger_wizard.xml

@ -13,7 +13,7 @@
</group>
<group name="date_currency_filter">
<group name="date_ranger">
<!-- <field name="date_range"/> -->
<field name="date_range_id"/>
<field name="date_from"/>
<field name="date_to"/>
</group>

24
account_financial_report_qweb/wizard/ledger_report_wizard.py

@ -11,7 +11,7 @@ class LedgerReportWizard(models.TransientModel):
_description = "Ledger Report Wizard"
company_id = fields.Many2one(comodel_name='res.company')
# date_range = ??
date_range_id = fields.Many2one(comodel_name='date.range', required=True)
date_from = fields.Date()
date_to = fields.Date()
target_move = fields.Selection([('posted', 'All Posted Entries'),
@ -66,8 +66,14 @@ class LedgerReportWizard(models.TransientModel):
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = (
'journal_ids' in data['form'] and
data['form']['journal_ids'] or False
)
result['state'] = (
'target_move' in data['form'] and
data['form']['target_move'] or ''
)
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False
@ -79,7 +85,15 @@ class LedgerReportWizard(models.TransientModel):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move'])[0]
data['form'] = self.read(['date_from', 'date_to',
'journal_ids', 'target_move'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=self.env.context.get('lang', 'en_US'))
data['form']['used_context'] = (
dict(used_context, lang=self.env.context.get('lang', 'en_US'))
)
return self._print_report(data)
@api.onchange('date_range_id')
def onchange_date_range_id(self):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end

10
account_financial_report_qweb/wizard/partner_ledger_wizard.xml

@ -13,7 +13,7 @@
</group>
<group name="date_currency_filter">
<group name="date_ranger">
<!-- <field name="date_range"/> -->
<field name="date_range_id"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
@ -32,7 +32,7 @@
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1"/>
<footer>
<button name="button_print" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
@ -50,11 +50,5 @@
<field name="target">new</field>
</record>
<menuitem
parent="account.menu_finance_legal_statement"
action="action_partner_ledger_report_wizard"
id="menu_partner_ledger_report_wizard"/>
</data>
</openerp>
Loading…
Cancel
Save