[IMP] account : Added one fields.boolean('sent', readonly=1) and display the 'print' button and the 'send by email' button only if it is False.

bzr revid: mdi@tinyerp.com-20120524063238-ylx1djklh2zrydsq
This commit is contained in:
Divyesh Makwana (Open ERP) 2012-05-24 12:02:38 +05:30
parent 8cab7496e4
commit d8cc569708
4 changed files with 9 additions and 5 deletions

View File

@ -213,6 +213,7 @@ class account_invoice(osv.osv):
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
\n* The \'Paid\' state is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \
\n* The \'Cancelled\' state is used when user cancel invoice.'),
'sent': fields.boolean('Sent', readonly=True, help="It indicates that the invoice has been sent."),
'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"),
'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True,
help="If you use payment terms, the due date will be computed automatically at the generation "\
@ -287,6 +288,7 @@ class account_invoice(osv.osv):
'check_total': 0.0,
'internal_number': False,
'user_id': lambda s, cr, u, c: u,
'sent': False,
}
_sql_constraints = [
('number_uniq', 'unique(number, company_id, journal_id, type)', 'Invoice Number must be unique per Company!'),
@ -641,6 +643,7 @@ class account_invoice(osv.osv):
'move_name':False,
'internal_number': False,
'period_id': False,
'sent': False,
})
if 'date_invoice' not in default:
default.update({

View File

@ -262,15 +262,15 @@
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="action_invoice_sent" type="object" string="Send by Email" states="open"/>
<button name="invoice_print" string="Print Invoice" type="object" states="open"/>
<button name="action_invoice_sent" type="object" string="Send by Email" states="open" attrs="{'invisible':['|',('sent','=',True), ('state', '=', 'draft')]}"/>
<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_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','&lt;&gt;','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"/>
<!--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"}'/>
</div>
@ -293,6 +293,7 @@
<newline/>
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
<field name="name"/>
<field name="sent"/>
</group>
<notebook colspan="4">
<page string="Invoice">

View File

@ -34,7 +34,7 @@ invoice_validate()</field>
<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="action">write({'state':'sent', 'sent':True})</field>
<field name="kind">function</field>
</record>

View File

@ -21,7 +21,7 @@
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
usage="default"
multi="True"/>
/>
<report id="account_transfers" model="account.transfer" name="account.transfer" string="Transfers" xml="account/report/transfer.xml" xsl="account/report/transfer.xsl"/>
<report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>