Use form relate and remove OpenLimit wizard
This commit is contained in:
parent
10dbaa22d5
commit
d630fff2be
|
@ -8,6 +8,3 @@ def register():
|
|||
Pool.register(
|
||||
Party,
|
||||
module='party_credit_limit', type_='model')
|
||||
Pool.register(
|
||||
OpenLimit,
|
||||
module='party_credit_limit', type_='wizard')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
|
@ -30,9 +30,9 @@ msgctxt "model:ir.action,name:act_party_credit_limit_form"
|
|||
msgid "Credit Limits"
|
||||
msgstr "Límits de crèdit"
|
||||
|
||||
msgctxt "model:ir.action,name:act_wizard_credit_limit"
|
||||
msgid "Credit Limit"
|
||||
msgstr "Límit de crèdit"
|
||||
msgctxt "model:ir.action,name:act_party_credit_limit_relate"
|
||||
msgid "Credit Limits"
|
||||
msgstr "Límits de crèdit"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_party_credit_limit_form"
|
||||
msgid "Credit Limits"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
|
@ -30,9 +30,9 @@ msgctxt "model:ir.action,name:act_party_credit_limit_form"
|
|||
msgid "Credit Limits"
|
||||
msgstr "Límites de crédito"
|
||||
|
||||
msgctxt "model:ir.action,name:act_wizard_credit_limit"
|
||||
msgid "Credit Limit"
|
||||
msgstr "Límite de crédito"
|
||||
msgctxt "model:ir.action,name:act_party_credit_limit_relate"
|
||||
msgid "Credit Limits"
|
||||
msgstr "Límites de crédito"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_party_credit_limit_form"
|
||||
msgid "Credit Limits"
|
||||
|
|
22
party.py
22
party.py
|
@ -8,9 +8,8 @@ from sql.conditionals import Coalesce, Case
|
|||
from trytond.model import fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import Wizard, StateAction
|
||||
|
||||
__all__ = ['Party', 'OpenLimit']
|
||||
__all__ = ['Party']
|
||||
|
||||
|
||||
class Party:
|
||||
|
@ -169,22 +168,3 @@ class Party:
|
|||
def _credit_limit_to_lock(cls):
|
||||
models = super(Party, cls)._credit_limit_to_lock()
|
||||
return models + ['account.invoice', 'sale.sale']
|
||||
|
||||
|
||||
class OpenLimit(Wizard):
|
||||
'Open Credit Limit'
|
||||
__name__ = 'party.party.open_credit_limit'
|
||||
start_state = 'open_'
|
||||
open_ = StateAction('party_credit_limit.act_party_credit_limit_form')
|
||||
|
||||
def do_open_(self, action):
|
||||
active_ids = Transaction().context['active_ids']
|
||||
data = {
|
||||
'res_id': active_ids
|
||||
}
|
||||
if len(active_ids) == 1:
|
||||
action['views'].reverse()
|
||||
return action, data
|
||||
|
||||
def transition_open_(self):
|
||||
return 'end'
|
||||
|
|
24
party.xml
24
party.xml
|
@ -33,15 +33,29 @@
|
|||
action="act_party_credit_limit_form"
|
||||
id="menu_party_credit_limit_form"/>
|
||||
|
||||
<record model="ir.action.wizard" id="act_wizard_credit_limit">
|
||||
<field name="name">Credit Limit</field>
|
||||
<field name="wiz_name">party.party.open_credit_limit</field>
|
||||
<record model="ir.action.act_window" id="act_party_credit_limit_relate">
|
||||
<field name="name">Credit Limits</field>
|
||||
<field name="res_model">party.party</field>
|
||||
<field name="domain" eval="[('id', 'in', Eval('active_ids'))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_party_credit_limit_relate_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="party_credit_limit_view_tree"/>
|
||||
<field name="act_window" ref="act_party_credit_limit_relate"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_party_credit_limit_relate_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="party_credit_limit_view_form"/>
|
||||
<field name="act_window" ref="act_party_credit_limit_relate"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_related_credit_limit_keyword1">
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="keyword">form_relate</field>
|
||||
<field name="model">party.party,-1</field>
|
||||
<field name="action" ref="act_wizard_credit_limit"/>
|
||||
<field name="action" ref="act_party_credit_limit_relate"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
Loading…
Reference in New Issue