[IMP]: improve voucher module improve workflow
[FIX]: fix a problem of voucher calculations bzr revid: mga@tinyerp.com-20100814075303-snt0eu35812nize0
This commit is contained in:
@@ -398,7 +398,7 @@
|
||||
</record>
|
||||
<record id="cash_journal" model="account.journal">
|
||||
<field name="name">Cash Journal - (test)</field>
|
||||
<field name="code">CHK</field>
|
||||
<field name="code">CSH</field>
|
||||
<field name="type">cash</field>
|
||||
<field name="view_id" ref="account_journal_bank_view"/>
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
!assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I change the state of voucher to "proforma" by clicking PRO-FORMA button
|
||||
I compute the voucher to calculate the taxes by clicking Cpmpute button
|
||||
-
|
||||
!workflow {model: account.voucher, action: open_voucher, ref: account_voucher_voucherforaxelor0}
|
||||
-
|
||||
|
||||
@@ -137,7 +137,7 @@ class account_voucher(osv.osv):
|
||||
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Real Entry'),
|
||||
#'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'audit':fields.boolean('Audit Complete ?', required=False),
|
||||
'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -292,14 +292,18 @@ class account_voucher(osv.osv):
|
||||
|
||||
if total != 0:
|
||||
res = {
|
||||
'amount':total,
|
||||
'state':'proforma'
|
||||
'amount':total
|
||||
}
|
||||
self.write(dbcr, uid, ids, res)
|
||||
else:
|
||||
raise osv.except_osv(_('Invalid amount !'), _('You can not create Pro-Forma voucher with Total amount <= 0 !'))
|
||||
return True
|
||||
|
||||
def voucher_recheck(self, cr, uid, ids, context={}):
|
||||
self.open_voucher(cr, uid, ids, context)
|
||||
self.write(cr, uid, ids, {'state':'recheck'}, context)
|
||||
return True
|
||||
|
||||
def proforma_voucher(self, cr, uid, ids, context={}):
|
||||
self.action_move_line_create(cr, uid, ids)
|
||||
self.write(cr, uid, ids, {'state':'posted'})
|
||||
|
||||
@@ -70,11 +70,11 @@
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="open_voucher" string="Pro-forma" states="draft" icon="terp-check"/>
|
||||
<button name="proforma_voucher" string="Create" states="proforma" icon="terp-document-new"/>
|
||||
<button name="open_voucher" string="Compute" states="draft" type="object" icon="terp-stock_format-scientific"/>
|
||||
<button name="proforma_voucher" string="Create" states="draft" icon="terp-document-new"/>
|
||||
<button name="recheck_voucher" string="Approve" states="recheck" icon="terp-check"/>
|
||||
<button name="audit_complete" string="Audit Pass" states="posted" icon="terp-check"/>
|
||||
<button name="cancel_voucher" string="Cancel" states="proforma,recheck,posted" icon="gtk-cancel"/>
|
||||
<!-- <button name="audit_complete" string="Audit Pass" states="posted" icon="terp-check"/>-->
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma,recheck" icon="gtk-cancel"/>
|
||||
<button name="cancel_to_draft" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
<field name="on_create">True</field>
|
||||
</record>
|
||||
|
||||
<record id="act_draft" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="name">draft</field>
|
||||
<field name="action">write({'state':'draft'})</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="act_draft" model="workflow.activity">-->
|
||||
<!-- <field name="wkf_id" ref="wkf"/>-->
|
||||
<!-- <field name="name">draft</field>-->
|
||||
<!-- <field name="kind">function</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- -->
|
||||
<record id="act_proforma" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="name">proforma</field>
|
||||
<field name="action">open_voucher()</field>
|
||||
<field name="action">write({'state':'draft'})</field>
|
||||
<!-- <field name="action">open_voucher()</field>-->
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
<field name="name">done</field>
|
||||
<field name="action">proforma_voucher()</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="flow_stop">True</field>
|
||||
</record>
|
||||
|
||||
<record id="act_recheck" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">recheck</field>
|
||||
<field name="action">write({'state':'recheck'})</field>
|
||||
<field name="action">voucher_recheck()</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
@@ -42,20 +43,20 @@
|
||||
<field name="action">cancel_voucher()</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="act_audit" model="workflow.activity">-->
|
||||
<!-- <field name="wkf_id" ref="wkf"/>-->
|
||||
<!-- <field name="name">audit</field>-->
|
||||
<!-- <field name="action">audit_pass()</field>-->
|
||||
<!-- <field name="flow_stop">True</field>-->
|
||||
<!-- <field name="kind">function</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="act_audit" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">audit</field>
|
||||
<field name="action">audit_pass()</field>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
<record id="t1" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_proforma"/>
|
||||
<field name="signal">open_voucher</field>
|
||||
</record>
|
||||
<!-- <record id="t1" model="workflow.transition">-->
|
||||
<!-- <field name="act_from" ref="act_draft"/>-->
|
||||
<!-- <field name="act_to" ref="act_proforma"/>-->
|
||||
<!-- <field name="signal">open_voucher</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="t2" model="workflow.transition">
|
||||
<field name="act_from" ref="act_proforma"/>
|
||||
@@ -103,7 +104,7 @@
|
||||
|
||||
<record id="t8" model="workflow.transition">
|
||||
<field name="act_from" ref="act_cancel"/>
|
||||
<field name="act_to" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_proforma"/>
|
||||
<field name="signal">cancel_to_draft</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user