Merge lp:~openerp-dev/openobject-addons/trunk-account-installer-wizard-pza into lp:openobject-addons

Proposed by Pooja Zankhariya(OpenERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-account-installer-wizard-pza
Merge into: lp:openobject-addons
Diff against target: 119 lines (+48/-1)
5 files modified
account/account.py (+10/-0)
account/account_installer.xml (+2/-0)
account/installer.py (+14/-0)
account/partner.py (+14/-1)
account/partner_view.xml (+8/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-account-installer-wizard-pza
Reviewer Review Type Date Requested Status
Thibault Delavallée (OpenERP) (community) Needs Fixing
Review via email: mp+196270@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-05.

Description of the change

[IMP] account: when the account payable and account receivable are empty on a partner form view, display a message to warn and help the setup of a chart of accounts.

To post a comment you must log in.
8965. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8966. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8967. By Pooja Zankhariya(OpenERP)

[IMP]Improved Code.

8968. By Pooja Zankhariya(OpenERP)

[IMP]Removed Group from div

8969. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trun

8970. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8971. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8972. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8973. By Pooja Zankhariya(OpenERP)

[MERGE]Merge with Trunk

8974. By Pooja Zankhariya(OpenERP)

[MERGE]Sync with Trunk

8975. By Pooja Zankhariya(OpenERP)

[MERGE]Sync with Trunk

8976. By Pooja Zankhariya(OpenERP)

[MERGE]Sync with Trunk

Revision history for this message
Thibault Delavallée (OpenERP) (tde-openerp) wrote :

Hello,

In account/installer.py: I don't see the point with the _next override. When removing this code, everything seems to work fine. Please confirm that this code is not necessary and remove it.

In account/partner.py:
- _check_coa_configured: simplifty code using return bool(prop_ids)

In account/partner_view.py:
- next_action does not seem necessary; introduce a key 'reload_page' replacing next action, and handle it in account/account.py, in _next.

In account/account.py:
- probably replace next_action by reload_page
- context.get returns None by default: no need to use if context.get(key, False) -> if context.get(key)
- instead of updating context, simply remove the key from context (context.pop(key))

review: Needs Fixing
8977. By Jitendra Prajapati(OpenERP)

[MERGE]with lp:openobject-addons

8978. By Jitendra Prajapati(OpenERP)

[IMP]improve code:replace next_action by reload_page, remove the key from context using pop method and use if context.get(key, False) -> if context.get(key)

8979. By Jitendra Prajapati(OpenERP)

[MERGE]with lp:openobject-addons

8980. By Jitendra Prajapati(OpenERP)

[IMP]check context

8981. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

8982. By Randhir Mayatra (OpenERP)

[IMP]add coa configuration links on product and product category

8983. By Randhir Mayatra (OpenERP)

[IMP]improve help string regarding coa in partner form

8984. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8985. By Randhir Mayatra (OpenERP)

[IMP] imrpoved message as per access right

8986. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8987. By Randhir Mayatra (OpenERP)

[IMP] improve help string

8988. By Randhir Mayatra (OpenERP)

[IMP] improve warning message as per the user access right

8989. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8990. By Randhir Mayatra (OpenERP)

[IMP] optimize code

8991. By Randhir Mayatra (OpenERP)

[IMP] improved search methods

8992. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8993. By Randhir Mayatra (OpenERP)

[IMP] imorived company_id domain

8994. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8995. By Randhir Mayatra (OpenERP)

[IMP] update open_account_installer method

Unmerged revisions

8995. By Randhir Mayatra (OpenERP)

[IMP] update open_account_installer method

8994. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8993. By Randhir Mayatra (OpenERP)

[IMP] imorived company_id domain

8992. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8991. By Randhir Mayatra (OpenERP)

[IMP] improved search methods

8990. By Randhir Mayatra (OpenERP)

[IMP] optimize code

8989. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

8988. By Randhir Mayatra (OpenERP)

[IMP] improve warning message as per the user access right

8987. By Randhir Mayatra (OpenERP)

[IMP] improve help string

8986. By Randhir Mayatra (OpenERP)

[MERGE] merge with latest trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2014-01-29 18:47:03 +0000
3+++ account/account.py 2014-02-05 07:01:47 +0000
4@@ -3412,6 +3412,16 @@
5 obj_tax_temp.write(cr, uid, ref_tax_ids, {'amount': value/100.0, 'name': _('Purchase Tax %.2f%%') % value})
6 return True
7
8+ def _next(self, cr, uid, context=None):
9+ res = super(wizard_multi_charts_accounts, self)._next(cr, uid, context=context)
10+ if context.get('reload_page'):
11+ res = {
12+ 'type': 'ir.actions.client',
13+ 'tag': 'reload',
14+ }
15+ context.pop('reload_page')
16+ return res
17+
18 def execute(self, cr, uid, ids, context=None):
19 '''
20 This function is called at the confirmation of the wizard to generate the COA from the templates. It will read
21
22=== modified file 'account/account_installer.xml'
23--- account/account_installer.xml 2013-10-27 12:31:04 +0000
24+++ account/account_installer.xml 2014-02-05 07:01:47 +0000
25@@ -11,6 +11,8 @@
26 <footer position="replace">
27 <footer>
28 <button name="action_next" context="{'default_charts':charts}" type="object" string="Continue" class="oe_highlight"/>
29+ or
30+ <button string="Cancel" special="cancel" class="oe_link"/>
31 </footer>
32 </footer>
33 <separator string="title" position="replace">
34
35=== modified file 'account/installer.py'
36--- account/installer.py 2013-10-27 12:31:04 +0000
37+++ account/installer.py 2014-02-05 07:01:47 +0000
38@@ -135,6 +135,20 @@
39 return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}}
40 return {}
41
42+ def _next(self, cr, uid, context=None):
43+ ir_todo_obj = self.pool.get('ir.actions.todo')
44+ ir_model_obj = self.pool.get('ir.model.data')
45+ if context.get('reload_page'):
46+ action_id = ir_model_obj.get_object_reference(cr, uid, 'account', 'account_configuration_installer_todo')[1]
47+ state = ir_todo_obj.browse(cr, uid, action_id, context=context).state
48+ if state == 'open':
49+ ir_todo_obj.write(cr, uid, action_id, {'state':'done'}, context=context)
50+ action_id = ir_model_obj.get_object_reference(cr, uid, 'account', context['reload_page'])[1]
51+ state = ir_todo_obj.browse(cr, uid, action_id, context=context).state
52+ if state == 'done':
53+ ir_todo_obj.write(cr, uid, action_id, {'state':'open'}, context=context)
54+ return super(account_installer, self)._next(cr, uid, context=context)
55+
56 def execute(self, cr, uid, ids, context=None):
57 self.execute_simple(cr, uid, ids, context)
58 return super(account_installer, self).execute(cr, uid, ids, context=context)
59
60=== modified file 'account/partner.py'
61--- account/partner.py 2013-11-27 15:32:57 +0000
62+++ account/partner.py 2014-02-05 07:01:47 +0000
63@@ -185,6 +185,14 @@
64 def mark_as_reconciled(self, cr, uid, ids, context=None):
65 return self.write(cr, uid, ids, {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
66
67+ def _check_coa_configured(self, cr, uid, context=None):
68+ company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
69+ prop_ids = self.pool.get('ir.property').search(cr, uid, [('name','in',('property_account_receivable', 'property_account_payable')),('company_id','=',company_id)], context=context)
70+ return bool(prop_ids)
71+
72+ def _get_coa_configured(self, cr, uid, ids, field_names, arg, context=None):
73+ return dict.fromkeys(ids, self._check_coa_configured(cr, uid, context=context))
74+
75 _columns = {
76 'credit': fields.function(_credit_debit_get,
77 fnct_search=_credit_search, string='Total Receivable', multi='dc', help="Total amount this customer owes you."),
78@@ -222,9 +230,14 @@
79 help="This payment term will be used instead of the default one for purchase orders and supplier invoices"),
80 'ref_companies': fields.one2many('res.company', 'partner_id',
81 'Companies that refers to partner'),
82- 'last_reconciliation_date': fields.datetime('Latest Full Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the last date where a reconciliation has been made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 different ways: either the last unreconciled debit/credit entry of this partner was reconciled, either the user pressed the button "Nothing more to reconcile" during the manual reconciliation process.')
83+ 'last_reconciliation_date': fields.datetime('Latest Full Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the last date where a reconciliation has been made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 different ways: either the last unreconciled debit/credit entry of this partner was reconciled, either the user pressed the button "Nothing more to reconcile" during the manual reconciliation process.'),
84+ 'is_coa_configured': fields.function(_get_coa_configured, type='boolean', string='COA Configured')
85 }
86
87+ _defaults = {
88+ 'is_coa_configured': _check_coa_configured
89+ }
90+
91 def _commercial_fields(self, cr, uid, context=None):
92 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
93 ['debit_limit', 'property_account_payable', 'property_account_receivable', 'property_account_position',
94
95=== modified file 'account/partner_view.xml'
96--- account/partner_view.xml 2013-10-27 12:31:04 +0000
97+++ account/partner_view.xml 2014-02-05 07:01:47 +0000
98@@ -115,6 +115,7 @@
99 <field name="property_account_payable" groups="account.group_account_invoice"/>
100 <field name="property_supplier_payment_term" widget="selection"/>
101 <field name="debit"/>
102+ <field name="is_coa_configured" invisible="1"/>
103 </group>
104 </group>
105 <field name="bank_ids" context="{'default_partner_id': active_id, 'form_view_ref': 'base.view_partner_bank_form'}">
106@@ -133,6 +134,13 @@
107 </div>
108 </page>
109 </page>
110+ <sheet position="before">
111+ <div name="warning" class="oe_form_box_info oe_text_center" attrs="{'invisible':[('is_coa_configured','=',True)]}">
112+ <p>It seems that accounting data is not well configured for your company to create new record here.</p>
113+ <p>You can configure your chart of accounts and taxes in 2 clicks from here:
114+ <button type="action" name="%(account.action_account_configuration_installer)d" context="{'reload_page': 'action_wizard_multi_chart_todo'}" string="Setup Accounting Information" class="oe_link" special="nosave"/></p>
115+ </div>
116+ </sheet>
117 </field>
118 </record>
119 </data>

Subscribers

People subscribed via source and target branches

to all changes: