Change date_planned into delay
bzr revid: ced-2bd4281a4c9229367482e82761a4eec403d3a322
This commit is contained in:
parent
cd15ac9150
commit
357d945ee5
|
@ -145,7 +145,7 @@
|
||||||
<para style="P14">Applicable Taxes</para>
|
<para style="P14">Applicable Taxes</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="P13">Date Promised</para>
|
<para style="P13">Delay</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="P13">Qty</para>
|
<para style="P13">Qty</para>
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
<para style="P17">[[ ', '.join(map(lambda x: x.name, line.tax_id))]]</para>
|
<para style="P17">[[ ', '.join(map(lambda x: x.name, line.tax_id))]]</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="P17">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
|
<para style="P17">[[ line.delay ]]</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="P18">[[ line.product_uos_qty or line.product_uom_qty ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para>
|
<para style="P18">[[ line.product_uos_qty or line.product_uom_qty ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para>
|
||||||
|
|
|
@ -332,6 +332,7 @@ class sale_order(osv.osv):
|
||||||
picking_id = False
|
picking_id = False
|
||||||
for line in order.order_line:
|
for line in order.order_line:
|
||||||
proc_id=False
|
proc_id=False
|
||||||
|
date_planned = (DateTime.now() + DateTime.RelativeDateTime(days=line.delay or 0.0)).strftime('%Y-%m-%d')
|
||||||
if line.state == 'done':
|
if line.state == 'done':
|
||||||
continue
|
continue
|
||||||
if line.product_id and line.product_id.product_tmpl_id.type in ('product', 'consu'):
|
if line.product_id and line.product_id.product_tmpl_id.type in ('product', 'consu'):
|
||||||
|
@ -355,7 +356,7 @@ class sale_order(osv.osv):
|
||||||
'name':'SO:'+order.name,
|
'name':'SO:'+order.name,
|
||||||
'picking_id': picking_id,
|
'picking_id': picking_id,
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
'date_planned': line.date_planned,
|
'date_planned': date_planned,
|
||||||
'product_qty': line.product_uom_qty,
|
'product_qty': line.product_uom_qty,
|
||||||
'product_uom': line.product_uom.id,
|
'product_uom': line.product_uom.id,
|
||||||
'product_uos_qty': line.product_uos_qty,
|
'product_uos_qty': line.product_uos_qty,
|
||||||
|
@ -372,7 +373,7 @@ class sale_order(osv.osv):
|
||||||
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
||||||
'name': order.name,
|
'name': order.name,
|
||||||
'origin': order.name,
|
'origin': order.name,
|
||||||
'date_planned': line.date_planned,
|
'date_planned': date_planned,
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
'product_qty': line.product_uom_qty,
|
'product_qty': line.product_uom_qty,
|
||||||
'product_uom': line.product_uom.id,
|
'product_uom': line.product_uom.id,
|
||||||
|
@ -387,7 +388,7 @@ class sale_order(osv.osv):
|
||||||
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
||||||
'name': line.name,
|
'name': line.name,
|
||||||
'origin': order.name,
|
'origin': order.name,
|
||||||
'date_planned': line.date_planned,
|
'date_planned': date_planned,
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
'product_qty': line.product_uom_qty,
|
'product_qty': line.product_uom_qty,
|
||||||
'product_uom': line.product_uom.id,
|
'product_uom': line.product_uom.id,
|
||||||
|
@ -487,7 +488,7 @@ class sale_order_line(osv.osv):
|
||||||
'order_id': fields.many2one('sale.order', 'Order Ref', required=True, ondelete='cascade', select=True),
|
'order_id': fields.many2one('sale.order', 'Order Ref', required=True, ondelete='cascade', select=True),
|
||||||
'name': fields.char('Description', size=256, required=True, select=True),
|
'name': fields.char('Description', size=256, required=True, select=True),
|
||||||
'sequence': fields.integer('Sequence'),
|
'sequence': fields.integer('Sequence'),
|
||||||
'date_planned': fields.date('Date Promised', required=True),
|
'delay': fields.float('Delay', required=True),
|
||||||
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], change_default=True, relate=True),
|
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], change_default=True, relate=True),
|
||||||
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id','invoice_id', 'Invoice Lines', readonly=True),
|
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id','invoice_id', 'Invoice Lines', readonly=True),
|
||||||
'invoiced': fields.boolean('Paid', readonly=True, select=True),
|
'invoiced': fields.boolean('Paid', readonly=True, select=True),
|
||||||
|
@ -516,7 +517,7 @@ class sale_order_line(osv.osv):
|
||||||
_order = 'sequence'
|
_order = 'sequence'
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'discount': lambda *a: 0.0,
|
'discount': lambda *a: 0.0,
|
||||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d'),
|
'delay': lambda *a: 0.0,
|
||||||
'product_uom_qty': lambda *a: 1,
|
'product_uom_qty': lambda *a: 1,
|
||||||
'product_uos_qty': lambda *a: 1,
|
'product_uos_qty': lambda *a: 1,
|
||||||
'sequence': lambda *a: 10,
|
'sequence': lambda *a: 10,
|
||||||
|
@ -598,9 +599,9 @@ class sale_order_line(osv.osv):
|
||||||
if price is False:
|
if price is False:
|
||||||
raise osv.except_osv('No valid pricelist line found !', "Couldn't find a pricelist line matching this product and quantity.\nYou have to change either the product, the quantity or the pricelist.")
|
raise osv.except_osv('No valid pricelist line found !', "Couldn't find a pricelist line matching this product and quantity.\nYou have to change either the product, the quantity or the pricelist.")
|
||||||
res = self.pool.get('product.product').read(cr, uid, [product], context=context)[0]
|
res = self.pool.get('product.product').read(cr, uid, [product], context=context)[0]
|
||||||
dt = (DateTime.now() + DateTime.RelativeDateTime(days=res['sale_delay'] or 0.0)).strftime('%Y-%m-%d')
|
# dt = (DateTime.now() + DateTime.RelativeDateTime(days=res['sale_delay'] or 0.0)).strftime('%Y-%m-%d')
|
||||||
|
|
||||||
result = {'price_unit': price, 'type':res['procure_method'], 'date_planned':dt, 'notes':res['description_sale']}
|
result = {'price_unit': price, 'type':res['procure_method'], 'delay':(res['sale_delay'] or 0.0), 'notes':res['description_sale']}
|
||||||
|
|
||||||
taxes = self.pool.get('account.tax').browse(cr, uid, res['taxes_id'])
|
taxes = self.pool.get('account.tax').browse(cr, uid, res['taxes_id'])
|
||||||
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
|
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<field name="price_unit" select="1"/>
|
<field name="price_unit" select="1"/>
|
||||||
<field name="discount"/>
|
<field name="discount"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="date_planned" select="1"/>
|
<field name="delay" select="1"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<field name="tax_id" colspan="3"/>
|
<field name="tax_id" colspan="3"/>
|
||||||
<separator string="States" colspan="4"/>
|
<separator string="States" colspan="4"/>
|
||||||
|
@ -350,7 +350,7 @@
|
||||||
<field name="product_uom" string="UoM"/>
|
<field name="product_uom" string="UoM"/>
|
||||||
<field name="discount"/>
|
<field name="discount"/>
|
||||||
<field name="price_unit"/>
|
<field name="price_unit"/>
|
||||||
<field name="date_planned"/>
|
<field name="delay"/>
|
||||||
<field name="price_net"/>
|
<field name="price_net"/>
|
||||||
<field name="price_subtotal"/>
|
<field name="price_subtotal"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
<field name="price_unit" select="1"/>
|
<field name="price_unit" select="1"/>
|
||||||
<field name="discount"/>
|
<field name="discount"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="date_planned" select="1"/>
|
<field name="delay" select="1"/>
|
||||||
<field name="price_subtotal"/>
|
<field name="price_subtotal"/>
|
||||||
<field name="tax_id" colspan="3"/>
|
<field name="tax_id" colspan="3"/>
|
||||||
<separator string="States" colspan="4"/>
|
<separator string="States" colspan="4"/>
|
||||||
|
|
Loading…
Reference in New Issue