From e01f21d04528a1b8daa2ce62cfba676362e1f4f0 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 22 Jun 2010 15:09:41 +0530 Subject: [PATCH 1/2] [IMP] sale_delivery_report,sale,delivery:Improvements made as per the testing bzr revid: mtr@mtr-20100622093941-04w864f1c8dxh3u7 --- addons/delivery/delivery.py | 2 +- addons/sale/sale.py | 1 + .../{delivery_report.xml => sale_delivery_report.xml} | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename addons/sale_delivery_report/{delivery_report.xml => sale_delivery_report.xml} (100%) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 4b87e4c790e..f1fadd81bd4 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -149,7 +149,7 @@ class delivery_grid_line(osv.osv): 'name': fields.char('Name', size=32, required=True), 'grid_id': fields.many2one('delivery.grid', 'Grid',required=True), 'type': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable', required=True), - 'operator': fields.selection([('=','='),('<=','<='),('>=','>=')], 'Operator', required=True), + 'operator': fields.selection([('==','='),('<=','<='),('>=','>=')], 'Operator', required=True), 'max_value': fields.float('Maximum Value', required=True), 'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True), 'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True), diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 14282ecf355..7bc3b3fd5de 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -571,6 +571,7 @@ class sale_order(osv.osv): params = ', '.join(map(lambda x : str(x),product)) message = _('Sale order ') + " '" + o.name + "' "+ _("created on")+" '" +o.create_date + "' "+_("for")+" '" +params + "' "+_("is confirmed") self.log(cr, uid, id, message) + return True def procurement_lines_get(self, cr, uid, ids, *args): diff --git a/addons/sale_delivery_report/delivery_report.xml b/addons/sale_delivery_report/sale_delivery_report.xml similarity index 100% rename from addons/sale_delivery_report/delivery_report.xml rename to addons/sale_delivery_report/sale_delivery_report.xml From 846ca104d00472c8671b1d0ea0d6fcfe4b5e1f87 Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 24 Jun 2010 13:20:00 +0530 Subject: [PATCH 2/2] [IMP] sale,sale_journal,sale_margin:Improvements made as per the testing bzr revid: mtr@mtr-20100624075000-7i6auafofeueg9lu --- addons/sale/sale.py | 9 +++--- addons/sale/test/advance_invoice.yml | 3 -- addons/sale/test/prepaid_sale_order.yml | 1 - addons/sale/test/so_make_invoice.yml | 3 -- addons/sale/test/so_make_line_invoice.yml | 3 -- addons/sale/wizard/sale_make_invoice.py | 8 +++--- addons/sale/wizard/sale_make_invoice.xml | 11 +++---- addons/sale_journal/sale_journal.py | 4 ++- addons/sale_journal/sale_journal_view.xml | 35 ++++++++++++++--------- addons/sale_margin/sale_margin.py | 2 +- addons/sale_margin/sale_margin_view.xml | 29 +++++++++++++++++-- 11 files changed, 67 insertions(+), 41 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 9fbdac14a23..e39df20f92e 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -429,7 +429,6 @@ class sale_order(osv.osv): for preline in preinv.invoice_line: inv_line_id = self.pool.get('account.invoice.line').copy(cr, uid, preline.id, {'invoice_id': False, 'price_unit': -preline.price_unit}) lines.append(inv_line_id) - inv = { 'name': order.client_order_ref or order.name, 'origin': order.name, @@ -462,7 +461,7 @@ class sale_order(osv.osv): invoices = {} invoice_ids = [] picking_obj = self.pool.get('stock.picking') - + invoice=self.pool.get('account.invoice') if context is None: context = {} # If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the @@ -477,7 +476,6 @@ class sale_order(osv.osv): created_lines = self.pool.get('sale.order.line').invoice_line_create(cr, uid, lines) if created_lines: invoices.setdefault(o.partner_id.id, []).append((o, created_lines)) - if not invoices: for o in self.browse(cr, uid, ids): for i in o.invoice_ids: @@ -486,11 +484,14 @@ class sale_order(osv.osv): for val in invoices.values(): if grouped: res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []), context=context) + temp_order='' for o, l in val: + temp_order=o.name + ',' + temp_order self.write(cr, uid, [o.id], {'state': 'progress'}) if o.order_policy == 'picking': picking_obj.write(cr, uid, map(lambda x: x.id, o.picking_ids), {'invoice_state': 'invoiced'}) cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res)) + invoice.write(cr, uid, [res], {'origin': temp_order}) else: for order, il in val: res = self._make_invoice(cr, uid, order, il, context=context) @@ -1102,7 +1103,7 @@ class sale_order_line(osv.osv): "You have to change either the product, the quantity or the pricelist." } else: - result.update({'price_unit': price}) + result.update({'price_unit': price,'purchase_price' : product_obj.standard_price}) return {'value': result, 'domain': domain, 'warning': warning} def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0, diff --git a/addons/sale/test/advance_invoice.yml b/addons/sale/test/advance_invoice.yml index 870b3ec0428..8b93b031d39 100644 --- a/addons/sale/test/advance_invoice.yml +++ b/addons/sale/test/advance_invoice.yml @@ -65,7 +65,6 @@ - !record {model: account.account, id: account_account_receivable0}: code: AR - company_id: base.main_company currency_mode: current name: Receivable parent_id: account_account_minimalchart0 @@ -79,7 +78,6 @@ - !record {model: account.account, id: account_account_cash0}: code: C - company_id: base.main_company currency_mode: current name: Cash parent_id: account_account_minimalchart0 @@ -142,7 +140,6 @@ - !record {model: account.journal, id: account_journal_bankjournal0}: code: BNK - company_id: base.main_company default_credit_account_id: account_account_cash0 default_debit_account_id: account_account_cash0 name: Bank Journal diff --git a/addons/sale/test/prepaid_sale_order.yml b/addons/sale/test/prepaid_sale_order.yml index 03f5ddf8aae..ce344bb23ae 100644 --- a/addons/sale/test/prepaid_sale_order.yml +++ b/addons/sale/test/prepaid_sale_order.yml @@ -78,7 +78,6 @@ - !record {model: account.account, id: account_account_cash0}: code: C - company_id: base.main_company currency_mode: current name: Cash parent_id: account_account_minimalchart0 diff --git a/addons/sale/test/so_make_invoice.yml b/addons/sale/test/so_make_invoice.yml index e34b11ffb2b..c5860ed875e 100644 --- a/addons/sale/test/so_make_invoice.yml +++ b/addons/sale/test/so_make_invoice.yml @@ -65,7 +65,6 @@ - !record {model: account.account, id: account_account_receivable0}: code: AR - company_id: base.main_company currency_mode: current name: Receivable parent_id: account_account_minimalchart0 @@ -79,7 +78,6 @@ - !record {model: account.account, id: account_account_cash0}: code: C - company_id: base.main_company currency_mode: current name: Cash parent_id: account_account_minimalchart0 @@ -142,7 +140,6 @@ - !record {model: account.journal, id: account_journal_bankjournal0}: code: BNK - company_id: base.main_company default_credit_account_id: account_account_cash0 default_debit_account_id: account_account_cash0 name: Bank Journal diff --git a/addons/sale/test/so_make_line_invoice.yml b/addons/sale/test/so_make_line_invoice.yml index de5782c8517..c09e4bf2c11 100644 --- a/addons/sale/test/so_make_line_invoice.yml +++ b/addons/sale/test/so_make_line_invoice.yml @@ -65,7 +65,6 @@ - !record {model: account.account, id: account_account_receivable0}: code: AR - company_id: base.main_company currency_mode: current name: Receivable parent_id: account_account_minimalchart0 @@ -79,7 +78,6 @@ - !record {model: account.account, id: account_account_cash0}: code: C - company_id: base.main_company currency_mode: current name: Cash parent_id: account_account_minimalchart0 @@ -142,7 +140,6 @@ - !record {model: account.journal, id: account_journal_bankjournal0}: code: BNK - company_id: base.main_company default_credit_account_id: account_account_cash0 default_debit_account_id: account_account_cash0 name: Bank Journal diff --git a/addons/sale/wizard/sale_make_invoice.py b/addons/sale/wizard/sale_make_invoice.py index 0ce2705ac77..850fc2e25d4 100644 --- a/addons/sale/wizard/sale_make_invoice.py +++ b/addons/sale/wizard/sale_make_invoice.py @@ -26,7 +26,7 @@ class sale_make_invoice(osv.osv_memory): _name = "sale.make.invoice" _description = "Sale Make Invoice" _columns = { - 'grouped': fields.boolean('Group the invoices'), + 'grouped': fields.boolean('Group the invoices', help='Check the box to group the invoices for the same customers'), 'invoice_date':fields.date('Invoice Date'), } _default = { @@ -50,11 +50,11 @@ class sale_make_invoice(osv.osv_memory): for o in order_obj.browse(cr, uid, context.get(('active_ids'),[]), context): for i in o.invoice_ids: newinv.append(i.id) - + mod_obj =self.pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - id = mod_obj.read(cr, uid, result, ['res_id']) + id = mod_obj.read(cr, uid, result, ['res_id']) return { 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]", 'name': 'Invoices', @@ -64,7 +64,7 @@ class sale_make_invoice(osv.osv_memory): 'view_id': False, 'context': "{'type':'out_refund'}", 'type': 'ir.actions.act_window', - 'search_view_id': id['id'] + 'search_view_id': id['res_id'] } sale_make_invoice() diff --git a/addons/sale/wizard/sale_make_invoice.xml b/addons/sale/wizard/sale_make_invoice.xml index ade720be1f4..e019786c40d 100644 --- a/addons/sale/wizard/sale_make_invoice.xml +++ b/addons/sale/wizard/sale_make_invoice.xml @@ -6,14 +6,15 @@ sale.make.invoice form -
- - + + + + - +