[IMP] removed old concept: invoice_quantity
bzr revid: fp@openerp.com-20130803190359-e3xpl2yye2u15104
This commit is contained in:
parent
5cbb5882d1
commit
9eb29913fa
|
@ -216,7 +216,6 @@ class sale_order(osv.osv):
|
|||
},
|
||||
multi='sums', help="The total amount."),
|
||||
|
||||
'invoice_quantity': fields.selection([('order', 'Ordered Quantities')], 'Invoice on', help="The sales order will automatically create the invoice proposition (draft invoice).", required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
|
@ -229,7 +228,6 @@ class sale_order(osv.osv):
|
|||
'state': 'draft',
|
||||
'user_id': lambda obj, cr, uid, context: uid,
|
||||
'name': lambda obj, cr, uid, context: '/',
|
||||
'invoice_quantity': 'order',
|
||||
'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'],
|
||||
'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
|
||||
'note': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.sale_note
|
||||
|
@ -780,15 +778,13 @@ class sale_order_line(osv.osv):
|
|||
}
|
||||
|
||||
def _get_line_qty(self, cr, uid, line, context=None):
|
||||
if (line.order_id.invoice_quantity=='order'):
|
||||
if line.product_uos:
|
||||
return line.product_uos_qty or 0.0
|
||||
if line.product_uos:
|
||||
return line.product_uos_qty or 0.0
|
||||
return line.product_uom_qty
|
||||
|
||||
def _get_line_uom(self, cr, uid, line, context=None):
|
||||
if (line.order_id.invoice_quantity=='order'):
|
||||
if line.product_uos:
|
||||
return line.product_uos.id
|
||||
if line.product_uos:
|
||||
return line.product_uos.id
|
||||
return line.product_uom.id
|
||||
|
||||
def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
-
|
||||
!record {model: sale.order, id: sale_order_so11}:
|
||||
date_order: !eval time.strftime('%Y-%m-%d')
|
||||
invoice_quantity: order
|
||||
name: Test_SO011
|
||||
order_line:
|
||||
- name: '[CARD] Graphics Card'
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
!record {model: sale.order, id: sale_order_so0}:
|
||||
client_order_ref: ref1
|
||||
date_order: !eval time.strftime('%Y-%m-%d')
|
||||
invoice_quantity: order
|
||||
name: Test_SO001
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
|
|
|
@ -38,18 +38,6 @@ class sale_order(osv.osv):
|
|||
})
|
||||
return super(sale_order, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
#Might have been deleted before for a reason
|
||||
def shipping_policy_change(self, cr, uid, ids, policy, context=None):
|
||||
if not policy:
|
||||
return {}
|
||||
inv_qty = 'order'
|
||||
if policy == 'prepaid':
|
||||
inv_qty = 'order'
|
||||
elif policy == 'picking':
|
||||
inv_qty = 'procurement'
|
||||
return {'value': {'invoice_quantity': inv_qty}}
|
||||
|
||||
|
||||
def _get_default_warehouse(self, cr, uid, context=None):
|
||||
company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
|
||||
warehouse_ids = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', company_id)], context=context)
|
||||
|
@ -78,11 +66,14 @@ class sale_order(osv.osv):
|
|||
|
||||
def _get_picking_ids(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for element in self.browse(cr, uid, ids, context=context):
|
||||
for procurement in element.procurement_group_id.procurement_ids:
|
||||
for sale in self.browse(cr, uid, ids, context=context):
|
||||
if not sale.procurement_group_id:
|
||||
res[sale.id] = []
|
||||
continue
|
||||
for procurement in sale.procurement_group_id.procurement_ids:
|
||||
if procurement.move_id and procurement.move_id.picking_id:
|
||||
picking_ids.append(procurement.move_id.picking_id.id)
|
||||
res[element.id] = list(set(picking_ids))
|
||||
res[sale.id] = list(set(picking_ids))
|
||||
return res
|
||||
|
||||
def _prepare_order_line_procurement(self, cr, uid, order, line, group_id = False, context=None):
|
||||
|
@ -116,7 +107,7 @@ class sale_order(osv.osv):
|
|||
('prepaid', 'Before Delivery'),
|
||||
], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||
help="""On demand: A draft invoice can be created from the sales order when needed. \nOn delivery order: A draft invoice can be created from the delivery order when the products have been delivered. \nBefore delivery: A draft invoice is created from the sales order and must be paid before the products can be delivered."""),
|
||||
'shipped': fields.function(_get_shipped, type='boolean', store={'stock.move': (_get_orders, ['state'], 10)}),
|
||||
'shipped': fields.function(_get_shipped, string='Delivered', type='boolean', store={'stock.move': (_get_orders, ['state'], 10)}),
|
||||
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
|
||||
'picking_ids': fields.function(_get_picking_ids, method=True, type='one2many', relation='stock.picking', string='Picking associated to this sale'),
|
||||
}
|
||||
|
|
|
@ -75,8 +75,7 @@
|
|||
<group name="logistics">
|
||||
<field name="incoterm" widget="selection" groups="base.group_user"/>
|
||||
<field name="picking_policy" required="True"/>
|
||||
<field name="order_policy" on_change="shipping_policy_change(order_policy)"/>
|
||||
<field name="invoice_quantity" invisible="True"/>
|
||||
<field name="order_policy"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue