From 9eb29913fa36def61ea2eadbaf65225df0f3dd45 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 3 Aug 2013 21:03:59 +0200 Subject: [PATCH] [IMP] removed old concept: invoice_quantity bzr revid: fp@openerp.com-20130803190359-e3xpl2yye2u15104 --- addons/sale/sale.py | 12 ++++-------- addons/sale_margin/test/sale_margin.yml | 1 - addons/sale_mrp/test/sale_mrp.yml | 1 - addons/sale_stock/sale_stock.py | 23 +++++++---------------- addons/sale_stock/sale_stock_view.xml | 3 +-- 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 94dc8bd9214..b9bc83f3c6f 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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): diff --git a/addons/sale_margin/test/sale_margin.yml b/addons/sale_margin/test/sale_margin.yml index 197f51a9681..f95f1ae49d2 100644 --- a/addons/sale_margin/test/sale_margin.yml +++ b/addons/sale_margin/test/sale_margin.yml @@ -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' diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml index 7cb1a17318d..d326e20be35 100644 --- a/addons/sale_mrp/test/sale_mrp.yml +++ b/addons/sale_mrp/test/sale_mrp.yml @@ -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 diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 0e5c2eaf031..ddf4e29e076 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -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'), } diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index 58bc53c815a..c7ad4b88044 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -75,8 +75,7 @@ - - +