add origin field on account.invoice.line. when make invoice from packing group by partner,origin will be fillup
bzr revid: hmo@tinyerp.com-20081118064613-95g26k1w3i8odg15
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
<field name="price_unit" select="1"/>
|
||||
<field name="discount"/>
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field colspan="4" name="origin" select="1"/>
|
||||
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(parent.partner_id,account_id)"/>
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', parent.company_id)]" name="account_analytic_id"/>
|
||||
<newline/>
|
||||
|
||||
@@ -861,6 +861,7 @@ class account_invoice_line(osv.osv):
|
||||
_description = "Invoice line"
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=256, required=True),
|
||||
'origin': fields.char('Origin', size=256, help="Reference of the document that produced this invoice."),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice Ref', ondelete='cascade', select=True),
|
||||
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'),
|
||||
'product_id': fields.many2one('product.product', 'Product', ondelete='set null'),
|
||||
|
||||
@@ -735,6 +735,7 @@ class sale_order_line(osv.osv):
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, line.order_id.partner_id, a)
|
||||
inv_id = self.pool.get('account.invoice.line').create(cr, uid, {
|
||||
'name': line.name,
|
||||
'origin':line.order_id.name,
|
||||
'account_id': a,
|
||||
'price_unit': pu,
|
||||
'quantity': uosqty,
|
||||
|
||||
+12
-2
@@ -625,10 +625,16 @@ class stock_picking(osv.osv):
|
||||
address_contact_id, address_invoice_id = \
|
||||
self._get_address_invoice(cursor, user, picking).values()
|
||||
|
||||
comment = self._get_comment_invoice(cursor, user, picking)
|
||||
|
||||
comment = self._get_comment_invoice(cursor, user, picking)
|
||||
if group and partner.id in invoices_group:
|
||||
invoice_id = invoices_group[partner.id]
|
||||
invoice=invoice_obj.browse(cursor, user,invoice_id)
|
||||
invoice_vals = {
|
||||
'name': invoice.name +', '+picking.name,
|
||||
'origin': invoice.origin+', '+picking.name+(picking.origin and (':' + picking.origin) or ''),
|
||||
'comment':(comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
|
||||
}
|
||||
invoice_obj.write(cursor, user, [invoice_id],invoice_vals,context=context)
|
||||
else:
|
||||
invoice_vals = {
|
||||
'name': picking.name,
|
||||
@@ -651,6 +657,9 @@ class stock_picking(osv.osv):
|
||||
invoices_group[partner.id] = invoice_id
|
||||
res[picking.id] = invoice_id
|
||||
for move_line in picking.move_lines:
|
||||
origin=move_line.picking_id.name
|
||||
if move_line.picking_id.origin:
|
||||
origin+=':' + move_line.picking_id.origin
|
||||
if group:
|
||||
name = picking.name + '-' + move_line.name
|
||||
else:
|
||||
@@ -679,6 +688,7 @@ class stock_picking(osv.osv):
|
||||
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner, account_id)
|
||||
invoice_line_id = invoice_line_obj.create(cursor, user, {
|
||||
'name': name,
|
||||
'origin':origin,
|
||||
'invoice_id': invoice_id,
|
||||
'uos_id': move_line.product_uos.id,
|
||||
'product_id': move_line.product_id.id,
|
||||
|
||||
Reference in New Issue
Block a user