[MERGE] merge with mma branch

bzr revid: psi@tinyerp.com-20120612131356-lu22z0f8yppospo5
This commit is contained in:
Purnendu Singh (OpenERP)
2012-06-12 18:43:56 +05:30
5 changed files with 60 additions and 17 deletions
+8 -4
View File
@@ -148,7 +148,7 @@
<field name="arch" type="xml">
<form version="7.0">
<header>
<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"/>
@@ -190,7 +190,7 @@
<field context="{'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line">
<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"/>
@@ -518,7 +518,9 @@
<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.
&lt;p&gt;
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"/>
@@ -561,7 +563,9 @@
<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.
&lt;p&gt;
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"/>
+35 -1
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,14 +1250,26 @@ class account_voucher(osv.osv):
'state': 'posted',
'number': name,
})
message = _("%s '%s' is <b>posted</b>.") % (self._get_document_type(voucher.type),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.
reconcile = False
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
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)
reconcile = 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)
if reconcile:
self.reconcile_send_note(cr, uid, [voucher.id], context=context)
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 +1283,27 @@ 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',
'sale': 'Sales Receipt',
'receipt': 'Customer Payment',
}
return type_dict.get(type, 'payment')
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)
def reconcile_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>reconciled</b>.") % (self._get_document_type(obj.type)), context=context)
account_voucher()
class account_voucher_line(osv.osv):
@@ -21,9 +21,11 @@
<field name="type">form</field>
<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>
<xpath expr="//button[@name='invoice_open']" position="after">
<div>
<button name="invoice_pay_customer" type="object" string="Pay" states="open" class="oe_form_button_hi"/>
</div>
</xpath>
</field>
</record>
</data>
@@ -145,7 +145,7 @@
<field name="arch" type="xml">
<form version="7.0">
<header>
<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)"/>
@@ -185,8 +185,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="account.group_account_user"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
</tree>
</field>
@@ -201,8 +201,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="account.group_account_user"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
</tree>
</field>
@@ -275,7 +275,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"/>
@@ -214,8 +214,8 @@
<field name="arch" type="xml">
<form version="7.0">
<header>
<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}">
<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="account.group_account_user"/>
<field name="name"/>
<field name="amount"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
@@ -299,6 +299,9 @@
<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.
&lt;p&gt;
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"/>