if context.get('type', 'sale') in ('purchase', 'payment'):
nodes = doc.xpath("//field[@name='partner_id']")
for node in nodes:
if context.get('type', 'sale') in ('purchase', 'payment'):
nodes = doc.xpath("//field[@name='partner_id']")
for node in nodes:
- node.set('domain', "[('supplier', '=', True)]")
+ node.set('context', "{'search_default_supplier': 1}")
+ if context.get('invoice_type','') in ('in_invoice', 'in_refund'):
+ node.set('string', _("Supplier"))
res['arch'] = etree.tostring(doc)
return res
res['arch'] = etree.tostring(doc)
return res
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
- mod,modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_dialog_form')
+ dummy, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_dialog_form')
+
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),
'view_mode': 'form',
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),
'view_mode': 'form',
'view_type': 'form',
'res_model': 'account.voucher',
'type': 'ir.actions.act_window',
'view_type': 'form',
'res_model': 'account.voucher',
'type': 'ir.actions.act_window',
'context': {
'default_partner_id': self._find_partner(inv).id,
'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual,
'context': {
'default_partner_id': self._find_partner(inv).id,
'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual,
- 'default_number':inv.name,
+ 'default_reference': inv.name,
'close_after_process': True,
'invoice_type': inv.type,
'invoice_id': inv.id,
'close_after_process': True,
'invoice_type': inv.type,
'invoice_id': inv.id,
<group>
<group>
<field name="state" invisible="1"/>
<group>
<group>
<field name="state" invisible="1"/>
- <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Supplier" context="{'search_default_supplier': 1}"/>
+ <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
<field name="currency_id" invisible="1"/>
<field name="amount" class="oe_inline"
string="Paid Amount"
<field name="currency_id" invisible="1"/>
<field name="amount" class="oe_inline"
string="Paid Amount"