[IMP]account_voucher :Improved menu tip, added group,and added OpenChatter in voucher

bzr revid: mma@tinyerp.com-20120604130438-26yoyil4pmzllg8b
This commit is contained in:
Mayur Maheshwari (OpenERP) 2012-06-04 18:34:38 +05:30
parent 37e59e65b3
commit 206a6383f0
5 changed files with 46 additions and 15 deletions

View File

@ -144,7 +144,7 @@
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="invoice_open" states="draft,proforma2" string="Validate"/>
<button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_form_button_hi"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,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="Set to Draft" type="object"/>
@ -156,7 +156,7 @@
</div>
<sheet string="Supplier Invoice" layout="auto">
<group col="8" colspan="4" class="oe_form_header">
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection" groups="base.group_account_user"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" width="50"/>
@ -180,7 +180,7 @@
<field colspan="4" context="{'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line" nolabel="1">
<tree string="Invoice lines">
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)" groups="base.group_account_user"/>
<field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="quantity"/>
@ -471,7 +471,7 @@
<field name="domain">[('type','=','in_invoice')]</field>
<field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice from your supplier according to what you purchased or received.</field>
<field name="help">Click here to create Supplier invoice.you can control the invoice from your supplier according to what you purchased or received. OpenERP can also generate draft invoices automatically from purchase orders or receipts.</field>
</record>
<menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/>
@ -510,7 +510,7 @@
<field name="domain">[('type','=','in_refund')]</field>
<field name="context">{'default_type': 'in_refund', 'type': 'in_refund', 'journal_type': 'purchase_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field>
<field name="help">Click here to create a new supplier refund.Track Refund you receive from your supplier. You can also generate refunds and reconcile them directly from the invoice form</field>
</record>
<menuitem action="action_invoice_tree4" id="menu_action_invoice_tree4" parent="menu_finance_payables"/>

View File

@ -250,6 +250,7 @@ class account_voucher(osv.osv):
_name = 'account.voucher'
_description = 'Accounting Voucher'
_inherit = ['mail.thread']
_order = "date desc, id desc"
# _rec_name = 'number'
_columns = {
@ -1249,6 +1250,8 @@ class account_voucher(osv.osv):
'state': 'posted',
'number': name,
})
message = _("voucher '%s' is posted.") % name
self.message_append_note(cr, uid, [voucher.id], body=message, context=context)
if voucher.journal_id.entry_posted:
move_pool.post(cr, uid, [move_id], context={})
# We automatically reconcile the account move lines.
@ -1257,6 +1260,12 @@ class account_voucher(osv.osv):
move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id)
return True
def create(self, cr, uid, vals, context=None):
voucher = super(account_voucher, self).create(cr, uid, vals, context=context)
if voucher:
self.create_send_note(cr, uid, [voucher], context=context)
return voucher
def copy(self, cr, uid, id, default={}, context=None):
default.update({
'state': 'draft',
@ -1270,6 +1279,21 @@ class account_voucher(osv.osv):
default['date'] = time.strftime('%Y-%m-%d')
return super(account_voucher, self).copy(cr, uid, id, default, context)
# --------------------------------------
# OpenChatter methods and notifications
# --------------------------------------
def _get_document_type(self, type):
type_dict = {
'payment': 'Supplier Payment',
'purchase': 'Purchase Receipt',
}
return type_dict.get(type, 'Invoice')
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id],body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)), context=context)
account_voucher()
class account_voucher_line(osv.osv):

View File

@ -19,7 +19,7 @@
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<button name="invoice_open" position="after">
<button name="invoice_pay_customer" type="object" string="Pay" states="open" icon="gtk-go-forward"/>
<button name="invoice_pay_customer" type="object" string="Pay" states="open"/>
</button>
</field>
</record>

View File

@ -145,7 +145,7 @@
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)"/>
<button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)" class="oe_form_button_hi"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma" invisible="context.get('line_type', False)"/>
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
@ -188,8 +188,8 @@
<field name="date_original" readonly="1"/>
<field name="date_due" readonly="1"/>
<field name="amount_original" readonly="1"/>
<field name="amount_unreconciled" readonly="1"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
<field name="amount_unreconciled" readonly="1" groups="base.group_account_user"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="base.group_account_user"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
</tree>
</field>
@ -204,8 +204,8 @@
<field name="date_original" readonly="1"/>
<field name="date_due" readonly="1"/>
<field name="amount_original" readonly="1"/>
<field name="amount_unreconciled" readonly="1"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
<field name="amount_unreconciled" readonly="1" groups="base.group_account_user"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="base.group_account_user"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
</tree>
</field>
@ -261,6 +261,9 @@
</page>
</notebook>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
</field>
</record>
@ -274,7 +277,7 @@
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
<field name="target">current</field>
<field name="help">The supplier payment form allows you to track the payment you do to your suppliers. When you select a supplier, the payment method and an amount for the payment, OpenERP will propose to reconcile your payment with the open supplier invoices or bills.</field>
<field name="help">Click on "Create" to register a supplier payment. Track payments you do to your supplier and amounts you pay</field>
</record>
<record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>

View File

@ -211,8 +211,8 @@
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="proforma_voucher" string="Validate" states="draft"/>
<button name="%(act_pay_bills)d" context="{'narration':narration, 'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id, 'reference':reference}" type="action" string="Pay Bill" attrs="{'invisible':['|',('pay_now','=','pay_now'),'|',('state','=','draft'), ('paid','=',True)]}"/>
<button name="proforma_voucher" string="Validate" states="draft" class="oe_form_button_hi"/>
<button name="%(act_pay_bills)d" context="{'narration':narration, 'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id, 'reference':reference}" type="action" string="Pay Bill" attrs="{'invisible':['|',('pay_now','=','pay_now'),'|',('state','=','draft'), ('paid','=',True)]}" class="oe_form_button_hi"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma" />
<button name="cancel_voucher" string="Cancel" type="object" states="posted" confirm="Are you sure to confirm this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
@ -239,7 +239,7 @@
<page string="Bill Information">
<field name="line_dr_ids" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" context="{'journal_id':journal_id,'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
<tree string="Expense Lines" editable="bottom">
<field name="account_id" widget="selection" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
<field name="account_id" widget="selection" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]" groups="base.group_account_user"/>
<field name="name"/>
<field name="amount"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
@ -285,6 +285,9 @@
</page>
</notebook>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
</field>
</record>
@ -297,6 +300,7 @@
<field name="view_id" eval="False"/>
<field name="search_view_id" eval="view_voucher_filter_vendor"/>
<field name="target">current</field>
<field name="help"> Click here to create a Purchase Receipt.When the purchase receipt is confirmed, you can record the supplier payment related to this Purchase receipt.</field>
</record>
<record id="action_purchase_receipt_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>