[IMP] invoice layout + merge note&name

bzr revid: fp@openerp.com-20120714203623-9n1iap9hplafnjp9
This commit is contained in:
Fabien Pinckaers 2012-07-14 22:36:23 +02:00
parent f10881855c
commit 16cce23c1a
9 changed files with 36 additions and 67 deletions

View File

@ -1345,7 +1345,7 @@ class account_invoice_line(osv.osv):
_name = "account.invoice.line"
_description = "Invoice Line"
_columns = {
'name': fields.char('Description', size=256, required=True),
'name': fields.text('Description', required=True),
'origin': fields.char('Source', size=256, help="Reference of the document that produced this invoice."),
'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='cascade', select=True),
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'),
@ -1357,7 +1357,6 @@ class account_invoice_line(osv.osv):
'quantity': fields.float('Quantity', required=True),
'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Account')),
'invoice_line_tax_id': fields.many2many('account.tax', 'account_invoice_line_tax', 'invoice_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]),
'note': fields.text('Notes'),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
@ -1430,7 +1429,8 @@ class account_invoice_line(osv.osv):
domain = {}
result['uos_id'] = res.uom_id.id or uom or False
result['note'] = res.description
if res.description:
result['name'] += '\n'+res.description
if result['uos_id']:
res2 = res.uom_id.category_id.id
if res2:
@ -1524,7 +1524,7 @@ class account_invoice_line(osv.osv):
def move_line_get_item(self, cr, uid, line, context=None):
return {
'type':'src',
'name': line.name[:64],
'name': line.name.split('\n')[0][:64],
'price_unit':line.price_unit,
'quantity':line.quantity,
'price':line.price_subtotal,

View File

@ -50,24 +50,27 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice Line" version="7.0">
<group col="4">
<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 name="name"/>
<label string="Quantity" for="quantity" align="1.0"/>
<div>
<field name="quantity" class="oe_inline"/>
<field name="uos_id" class="oe_inline"
on_change="uos_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)"/>
</div>
<field name="price_unit"/>
<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="account.group_account_user"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="invoice_line_tax_id" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]" widget="many2many_tags"/>
<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="company_id" groups="base.group_multi_company" readonly="1"/>
</group>
<separator string="Notes"/>
<field name="note"/>
<group>
<group>
<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)"/>
<label for="quantity"/>
<div>
<field name="quantity" class="oe_inline"/>
<field name="uos_id" class="oe_inline" groups="product.group_uom"
on_change="uos_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)"/>
</div>
<field name="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
</group>
<group>
<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="account.group_account_user"/>
<field name="invoice_line_tax_id" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]" widget="many2many_tags"/>
<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="company_id" groups="base.group_multi_company" readonly="1"/>
</group>
</group>
<label for="name"/>
<field name="name"/>
</form>
</field>
</record>

View File

@ -265,7 +265,7 @@
class="oe_edit_only"
attrs="{'invisible':['|',('carrier_id','=',False),('state','not in',('draft','sent'))]}"/>
<br/>
<label string="If you don't 'Add in Quote', the charges will be invoiced based on real delivery order(s)."
<label string="If you don't 'Add in Quote', the exact price will be computed when invoicing based on delivery order(s)."
class="oe_edit_only"
attrs="{'invisible':['|',('carrier_id','=',False),('state','not in',('draft','sent'))]}"/>
</div>

View File

@ -159,7 +159,7 @@ class account_analytic_line(osv.osv):
details.append(line['name'])
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note))
curr_line['name'] += "\n".join(map(lambda x: unicode(x) or '',note))
invoice_line_obj.create(cr, uid, curr_line, context=context)
cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s", (last_invoice, account.id, tuple(ids)))

View File

@ -36,7 +36,6 @@ SALE_ORDER_LINE_EDI_STRUCT = {
'price_unit': True,
#custom: 'product_qty'
'discount': True,
'notes': True,
# fields used for web preview only - discarded on import
'price_subtotal': True,

View File

@ -257,7 +257,7 @@
<blockTable colWidths="180.0,70.0,80.0,70.0,50.0,85.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ line.name ]] </para>
<para style="terp_default_9">[[ format(line.name) ]] </para>
</td>
<td>
<para style="terp_default_Centre_9">[[ ', '.join(map(lambda x: x.name, line.tax_id)) ]]</para>
@ -275,36 +275,6 @@
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'), currency_obj=o.pricelist_id.currency_id) ]] </para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Italic">[[ format(line.notes or removeParentNode('tr')) ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="381.0,60.0,93.0" style="Table6">

View File

@ -831,7 +831,7 @@ class sale_order(osv.osv):
def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
return {
'name': line.name,
'name': line.name.split('\n')[0],
'origin': order.name,
'date_planned': date_planned,
'product_id': line.product_id.id,
@ -845,7 +845,7 @@ class sale_order(osv.osv):
'procure_method': line.type,
'move_id': move_id,
'company_id': order.company_id.id,
'note': line.notes,
'note': '\n'.join(line.name.split('\n')[1:]),
'property_ids': [(6, 0, [x.id for x in line.property_ids])]
}
@ -853,7 +853,7 @@ class sale_order(osv.osv):
location_id = order.shop_id.warehouse_id.lot_stock_id.id
output_id = order.shop_id.warehouse_id.lot_output_id.id
return {
'name': line.name[:250],
'name': line.name.split('\n')[0][:250],
'picking_id': picking_id,
'product_id': line.product_id.id,
'date': date_planned,
@ -871,7 +871,7 @@ class sale_order(osv.osv):
'tracking_id': False,
'state': 'draft',
#'state': 'waiting',
'note': line.notes,
'note': '\n'.join(line.name.split('\n')[1:]),
'company_id': order.company_id.id,
'price_unit': line.product_id.standard_price or 0.0
}
@ -887,7 +887,7 @@ class sale_order(osv.osv):
'move_type': order.picking_policy,
'sale_id': order.id,
'partner_id': order.partner_shipping_id.id,
'note': order.note,
'note': '\n'.join(line.name.split('\n')[1:]),
'invoice_state': (order.order_policy=='picking' and '2binvoiced') or 'none',
'company_id': order.company_id.id,
}
@ -1129,7 +1129,6 @@ class sale_order_line(osv.osv):
'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True),
'discount': fields.float('Discount', digits=(16, 2), readonly=True, states={'draft': [('readonly', False)]}),
'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'),
'notes': fields.text('Notes'),
'th_weight': fields.float('Weight', readonly=True, states={'draft': [('readonly', False)]}),
'state': fields.selection([('cancel', 'Cancelled'),('draft', 'Draft'),('confirmed', 'Confirmed'),('exception', 'Exception'),('done', 'Done')], 'Status', required=True, readonly=True,
help='* The \'Draft\' state is set when the related sales order in draft state. \
@ -1222,7 +1221,6 @@ class sale_order_line(osv.osv):
'uos_id': uos_id,
'product_id': line.product_id.id or False,
'invoice_line_tax_id': [(6, 0, [x.id for x in line.tax_id])],
'note': line.notes,
'account_analytic_id': line.order_id.project_id and line.order_id.project_id.id or False,
}

View File

@ -214,9 +214,9 @@
<field name="product_uos" class="oe_inline oe_no_button"/>
</div>
<field name="price_unit"/>
<label for="discount"/>
<div>
<field name="discount" groups="sale.group_discount_per_so_line" class="oe_inline"/> %%
<label for="discount" groups="sale.group_discount_per_so_line"/>
<div groups="sale.group_discount_per_so_line">
<field name="discount" class="oe_inline"/> %%
</div>
</group>
<group>

View File

@ -108,7 +108,6 @@ class stock_picking(osv.osv):
'invoiced': True,
'invoice_lines': [(4, invoice_line_id)],
})
invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.sale_line_id.notes,})
return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id)
def _invoice_hook(self, cursor, user, picking, invoice_id):