[IMP] account: changes related to the cleaning of the invoice workflow
bzr revid: qdp-launchpad@openerp.com-20120525151740-vjho9b0fopbrils7
This commit is contained in:
parent
ab07d440ce
commit
65031e90ef
|
@ -204,7 +204,6 @@ class account_invoice(osv.osv):
|
|||
('proforma','Pro-forma'),
|
||||
('proforma2','Pro-forma'),
|
||||
('open','Open'),
|
||||
('sent','Sent'),
|
||||
('paid','Paid'),
|
||||
('cancel','Cancelled'),
|
||||
],'State', select=True, readonly=True,
|
||||
|
@ -370,13 +369,15 @@ class account_invoice(osv.osv):
|
|||
raise orm.except_orm(_('Unknown Error'), str(e))
|
||||
|
||||
def invoice_print(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_sent', cr)
|
||||
'''
|
||||
This function prints the invoice and mark it as sent, so that we can see more easily the next step of the workflow
|
||||
'''
|
||||
assert len(ids) == 1, 'This option should only be used for a single id at a time'
|
||||
self.write(cr, uid, ids, {'sent': True}, context=context)
|
||||
datas = {
|
||||
'ids': ids,
|
||||
'model': 'account.invoice',
|
||||
'form': self.read(cr, uid, ids, context=context)[0]
|
||||
'form': self.read(cr, uid, ids[0], context=context)
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
@ -386,6 +387,9 @@ class account_invoice(osv.osv):
|
|||
}
|
||||
|
||||
def action_invoice_sent(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function opens a window to compose an email, with the edi invoice template message loaded by default
|
||||
'''
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
template = mod_obj.get_object_reference(cr, uid, 'account', 'email_template_edi_invoice')
|
||||
template_id = template and template[1] or False
|
||||
|
@ -1715,8 +1719,7 @@ class mail_message(osv.osv):
|
|||
|
||||
def _postprocess_sent_message(self, cr, uid, message, context=None):
|
||||
if message.model == 'account.invoice':
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.invoice', message.res_id, 'invoice_sent', cr)
|
||||
self.pool.get('account.invoice').write(cr, uid, message.ids, {'sent':True}, context=context)
|
||||
return super(mail_message, self)._postprocess_sent_message(cr, uid, message=message, context=context)
|
||||
|
||||
mail_message()
|
||||
|
|
|
@ -266,13 +266,13 @@
|
|||
<button name="invoice_print" string="Print Invoice" type="object" states="open" attrs="{'invisible':['|',('sent','=',True), ('state', '=', 'draft')]}"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate"/>
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" groups="account.group_proforma_invoices"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='sent,paid'/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open,sent" string="Cancel" groups="base.group_no_one"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='paid'/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object"/>
|
||||
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','<>','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
|
||||
<!--button name="%(account_invoices)d" string="Print Invoice" type="action" states="open,paid,proforma,sale,proforma2"/-->
|
||||
<div class="oe_right">
|
||||
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,open,sent,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
</div>
|
||||
<div class="oe_clear"/>
|
||||
</div>
|
||||
|
|
|
@ -30,14 +30,6 @@ action_number()
|
|||
invoice_validate()</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
<record id="act_sent" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">sent</field>
|
||||
<field name="action">write({'state':'sent', 'sent':True})</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_open_test">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">re-open</field>
|
||||
|
@ -66,30 +58,13 @@ write({'state':'cancel'})</field>
|
|||
<field name="act_to" ref="act_open"/>
|
||||
<field name="signal">invoice_open</field>
|
||||
</record>
|
||||
<record id="open_to_sent" model="workflow.transition">
|
||||
<field name="act_from" ref="act_open"/>
|
||||
<field name="act_to" ref="act_sent"/>
|
||||
<field name="signal">invoice_sent</field>
|
||||
</record>
|
||||
<record id="open_to_paid" model="workflow.transition">
|
||||
<field name="act_from" ref="act_open"/>
|
||||
<field name="act_to" ref="act_paid"/>
|
||||
<field name="trigger_model">account.move.line</field>
|
||||
<field name="trigger_expr_id">move_line_id_payment_get()</field>
|
||||
<field name="condition">test_paid()</field>
|
||||
</record>
|
||||
<record id="t8" model="workflow.transition">
|
||||
<field name="act_from" ref="act_sent"/>
|
||||
<field name="act_from" ref="act_open"/>
|
||||
<field name="act_to" ref="act_paid"/>
|
||||
<field name="trigger_model">account.move.line</field>
|
||||
<field name="trigger_expr_id">move_line_id_payment_get()</field>
|
||||
<field name="condition">test_paid()</field>
|
||||
</record>
|
||||
<record id="sent_to_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_sent"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="signal">invoice_cancel</field>
|
||||
</record>
|
||||
<record id="t9" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
|
@ -111,11 +86,6 @@ write({'state':'cancel'})</field>
|
|||
<field name="signal">invoice_cancel</field>
|
||||
</record>
|
||||
|
||||
<record id="open_test_to_sent" model="workflow.transition">
|
||||
<field name="act_from" ref="act_open_test"/>
|
||||
<field name="act_to" ref="act_sent"/>
|
||||
<field name="signal">invoice_sent</field>
|
||||
</record>
|
||||
<record id="open_test_to_paid" model="workflow.transition">
|
||||
<field name="act_from" ref="act_open_test"/>
|
||||
<field name="act_to" ref="act_paid"/>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<!-- EDI Export + Send email Action -->
|
||||
<!--
|
||||
<record id="ir_actions_server_edi_invoice" model="ir.actions.server">
|
||||
<field name="code">if (object.type in ('out_invoice', 'out_refund')) and not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)</field>
|
||||
<field eval="6" name="sequence"/>
|
||||
|
@ -12,7 +11,6 @@
|
|||
<field name="condition">True</field>
|
||||
<field name="name">Auto-email confirmed invoices</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- EDI related Email Templates menu -->
|
||||
<record model="ir.actions.act_window" id="action_email_templates">
|
||||
|
@ -33,11 +31,9 @@
|
|||
so users can freely customize/delete them -->
|
||||
<data noupdate="1">
|
||||
<!-- bind the mailing server action to invoice open activity -->
|
||||
<!--
|
||||
<record id="account.act_open" model="workflow.activity">
|
||||
<field name="action_id" ref="ir_actions_server_edi_invoice"/>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!--Email template -->
|
||||
<record id="email_template_edi_invoice" model="email.template">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="invoice_open" position="after">
|
||||
<button name="invoice_pay_customer" type="object" string="Register Payment" states="open,sent" icon="gtk-go-forward"/>
|
||||
<button name="invoice_pay_customer" type="object" string="Register Payment" states="open" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -279,8 +279,12 @@ class purchase_order(osv.osv):
|
|||
return {'value':{'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
|
||||
|
||||
def view_invoice(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns an action that display existing invoices of given sale order ids. It can either be a in a list or in a form view, if there is only one invoice to show.
|
||||
'''
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
wizard_obj = self.pool.get('purchase.order.line_invoice')
|
||||
#compute the number of invoices to display
|
||||
inv_ids = []
|
||||
for po in self.browse(cr, uid, ids, context=context):
|
||||
if po.invoice_method == 'manual':
|
||||
|
@ -307,6 +311,9 @@ class purchase_order(osv.osv):
|
|||
}
|
||||
|
||||
def view_picking(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns an action that display existing pîcking orders of given purchase order ids.
|
||||
'''
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
pick_ids = []
|
||||
for po in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -333,6 +340,9 @@ class purchase_order(osv.osv):
|
|||
return True
|
||||
|
||||
def wkf_send_rfq(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function opens a window to compose an email, with the edi purchase template message loaded by default
|
||||
'''
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
template = mod_obj.get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase')
|
||||
template_id = template and template[1] or False
|
||||
|
|
|
@ -469,6 +469,9 @@ class sale_order(osv.osv):
|
|||
return inv_id
|
||||
|
||||
def print_quotation(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function prints the sale order and mark it as sent, so that we can see more easily the next step of the workflow
|
||||
'''
|
||||
assert len(ids) == 1, 'This option should only be used for a single id at a time'
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'sale.order', ids[0], 'quotation_sent', cr)
|
||||
|
|
Loading…
Reference in New Issue