Browse Source

[CHG] allows to select all the journal types in the Journals report, remove the second menu (it was hidden because the action had the same name

pull/7/merge
Guewen Baconnier 11 years ago
parent
commit
1aeb8968fe
  1. 11
      account_financial_report_webkit/report_menus.xml
  2. 20
      account_financial_report_webkit/wizard/print_journal.py
  3. 11
      account_financial_report_webkit/wizard/print_journal_view.xml

11
account_financial_report_webkit/report_menus.xml

@ -26,10 +26,13 @@
parent="account.menu_journals_report" action="action_account_print_journal_menu_webkit" parent="account.menu_journals_report" action="action_account_print_journal_menu_webkit"
groups="account.group_account_manager,account.group_account_user" id="account.menu_account_print_journal"/> groups="account.group_account_manager,account.group_account_user" id="account.menu_account_print_journal"/>
<menuitem icon="STOCK_PRINT" name="Sale/Purchase Journals"
parent="account.menu_journals_report" action="action_account_print_journal_sale_purchase_menu_webkit"
groups="account.group_account_manager,account.group_account_user" id="account.menu_account_print_sale_purchase_journal"
sequence="1"/>
<!--
Hide Sale / Purchase Journals menu, replaced by a unique
"Journals" menu
-->
<record id="account.menu_account_print_sale_purchase_journal" model="ir.ui.menu">
<field name="groups">base.group_no_one</field>
</record>
</data> </data>
</openerp> </openerp>

20
account_financial_report_webkit/wizard/print_journal.py

@ -105,26 +105,6 @@ class AccountReportPrintJournalWizard(orm.TransientModel):
res['value'] = {'period_from': start_period, 'period_to': end_period, 'date_from': False, 'date_to': False} res['value'] = {'period_from': start_period, 'period_to': end_period, 'date_from': False, 'date_to': False}
return res return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
'''
used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type
sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' in the context.
'''
if context is None:
context = {}
res = super(AccountReportPrintJournalWizard, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
doc = etree.XML(res['arch'])
if context.get('sale_purchase_only'):
domain = "[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"
else:
domain = "[('type', 'not in', ('sale','purchase','sale_refund','purchase_refund'))]"
nodes = doc.xpath("//field[@name='journal_ids']")
for node in nodes:
node.set('domain', domain)
res['arch'] = etree.tostring(doc)
return res
def _print_report(self, cursor, uid, ids, data, context=None): def _print_report(self, cursor, uid, ids, data, context=None):
context = context or {} context = context or {}
# we update form with display account value # we update form with display account value

11
account_financial_report_webkit/wizard/print_journal_view.xml

@ -86,16 +86,5 @@
<field name="model">account.journal.period</field> <field name="model">account.journal.period</field>
</record> </record>
<record id="action_account_print_journal_sale_purchase_menu_webkit" model="ir.actions.act_window">
<field name="name">Journals</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">print.journal.webkit</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_print_journal_view_webkit"/>
<field name="context">{'sale_purchase_only':True}</field>
<field name="target">new</field>
</record>
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save