[MERGE] account: merge with mdi branch related to account customer invoice changes
bzr revid: psi@tinyerp.com-20120229101348-6d5dgjlwntrx61pb
This commit is contained in:
@@ -202,7 +202,8 @@ class account_invoice(osv.osv):
|
||||
('draft','Draft'),
|
||||
('proforma','Pro-forma'),
|
||||
('proforma2','Pro-forma'),
|
||||
('open','Validate'),
|
||||
('open','Validated'),
|
||||
('sent','Sent'),
|
||||
('paid','Paid'),
|
||||
('cancel','Cancelled')
|
||||
],'State', select=True, readonly=True,
|
||||
@@ -370,6 +371,56 @@ class account_invoice(osv.osv):
|
||||
_('There is no Accounting Journal of type Sale/Purchase defined!'))
|
||||
else:
|
||||
raise orm.except_orm(_('Unknown Error'), str(e))
|
||||
|
||||
def _hook_message_sent(self, cr, uid, invoice_id, context=None):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_sent', cr)
|
||||
return True
|
||||
|
||||
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)
|
||||
datas = {
|
||||
'ids': ids,
|
||||
'model': 'account.invoice',
|
||||
'form': self.read(cr, uid, ids, context=context)[0]
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.invoice',
|
||||
'datas': datas,
|
||||
'nodestroy' : True
|
||||
}
|
||||
|
||||
def action_invoice_sent(self, cr, uid, ids, context=None):
|
||||
email_template_obj = self.pool.get('email.template')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
template_id = email_template_obj.search(cr, uid, [('model_id', '=', 'account.invoice')], context=context)[0]
|
||||
template = email_template_obj.browse(cr, uid, template_id)
|
||||
model_data_id = mod_obj._get_id(cr, uid, 'mail', 'email_compose_message_wizard_form')
|
||||
res_id = mod_obj.browse(cr, uid, model_data_id, context=context).res_id
|
||||
|
||||
#EDI EXport data
|
||||
id = ids[0]
|
||||
invoice = self.browse(cr, uid, id, context)
|
||||
if not invoice.partner_id.opt_out:
|
||||
invoice.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)
|
||||
ctx = context.copy()
|
||||
ctx.update({'active_model': 'account.invoice', 'active_id': invoice.id, 'mail.compose.template_id': template.id})
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'mail.compose.message',
|
||||
'views': [(res_id, 'form')],
|
||||
'view_id': res_id,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': ctx,
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
|
||||
@@ -299,16 +299,17 @@
|
||||
<field name="amount_tax"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,sent,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
<field name="residual"/>
|
||||
<group col="8" colspan="4" groups="base.group_user">
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel" groups="base.group_no_one"/>
|
||||
<button name="action_invoice_sent" type="object" string="Send By Email" icon="terp-mail-message-new" states="open"/>
|
||||
<button name="invoice_print" string="Print Invoice" type="object" icon="gtk-print" states="open,proforma,sale,proforma2"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,sent,paid' icon="gtk-execute"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open,sent" string="Cancel" icon="gtk-cancel" groups="base.group_no_one"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','<>','paid'), ('reconciled', '=', True)]}" icon="gtk-convert" 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="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
|
||||
<button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -30,6 +30,14 @@ action_number()
|
||||
write({'state':'open'})</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'})</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>
|
||||
@@ -58,13 +66,30 @@ write({'state':'cancel'})</field>
|
||||
<field name="act_to" ref="act_open"/>
|
||||
<field name="signal">invoice_open</field>
|
||||
</record>
|
||||
<record id="t8" model="workflow.transition">
|
||||
<record id="t_open_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="t_open_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_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="t_sent_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"/>
|
||||
@@ -86,6 +111,11 @@ 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"/>
|
||||
|
||||
@@ -772,7 +772,7 @@ class account_voucher(osv.osv):
|
||||
|
||||
def proforma_voucher(self, cr, uid, ids, context=None):
|
||||
self.action_move_line_create(cr, uid, ids, context=context)
|
||||
return True
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def action_cancel_draft(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
@@ -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="Payment" states="open" icon="gtk-go-forward"/>
|
||||
<button name="invoice_pay_customer" type="object" string="Register Payment" states="open,sent" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -36,7 +36,7 @@ class invoice(osv.osv):
|
||||
'res_model': 'account.voucher',
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'target': 'new',
|
||||
'domain': '[]',
|
||||
'context': {
|
||||
'default_partner_id': inv.partner_id.id,
|
||||
|
||||
@@ -403,10 +403,10 @@
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel" invisible="context.get('line_type', False)"/>
|
||||
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile and cancel this record ?"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
|
||||
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user