From 8fb9afcb1f94614912340b8e13a1e15aada441a3 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 22 Jun 2010 14:39:41 +0530 Subject: [PATCH 1/6] [REF] bzr revid: mra@mra-laptop-20100622090941-79ib4fqqzrmfa7io --- addons/sale_journal/__openerp__.py | 3 +-- addons/sale_journal/sale_journal.py | 30 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py index 94d343debb9..80643eb5d4d 100644 --- a/addons/sale_journal/__openerp__.py +++ b/addons/sale_journal/__openerp__.py @@ -19,7 +19,6 @@ # ############################################################################## - { 'name': 'Managing sales and deliveries by journal', 'version': '1.0', @@ -49,7 +48,7 @@ """, 'author': 'Tiny', 'website': 'http://www.openerp.com', - 'depends': ['stock', 'sale'], + 'depends': ['sale'], 'init_xml': ['sale_journal_data.xml'], 'update_xml': [ 'security/ir.model.access.csv', diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py index 9e6144998b0..41d770d5760 100644 --- a/addons/sale_journal/sale_journal.py +++ b/addons/sale_journal/sale_journal.py @@ -18,10 +18,10 @@ # along with this program. If not, see . # ############################################################################## +import time from osv import osv, fields import netsvc -import time from tools.translate import _ class sale_journal_invoice_type(osv.osv): @@ -34,8 +34,8 @@ class sale_journal_invoice_type(osv.osv): 'invoicing_method': fields.selection([('simple','Non grouped'),('grouped','Grouped')], 'Invoicing method', required=True), } _defaults = { - 'active': lambda *a: True, - 'invoicing_method': lambda *a:'simple' + 'active': True, + 'invoicing_method': 'simple' } sale_journal_invoice_type() @@ -60,12 +60,12 @@ class sale_journal(osv.osv): 'note': fields.text('Note'), } _defaults = { - 'date': lambda *a: time.strftime('%Y-%m-%d'), - 'date_created': lambda *a: time.strftime('%Y-%m-%d'), + 'date': time.strftime('%Y-%m-%d'), + 'date_created': time.strftime('%Y-%m-%d'), 'user_id': lambda self,cr,uid,context: uid, 'state': lambda self,cr,uid,context: 'draft', } - + def button_sale_cancel(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'cancel'}) for id in ids: @@ -75,9 +75,9 @@ class sale_journal(osv.osv): wf_service.trg_validate(uid, 'sale.order', saleid, 'cancel', cr) for (id,name) in self.name_get(cr, uid, ids): message = _('Sale order of Journal') + " '" + name + "' "+ _("is cancelled") - self.log(cr, uid, id, message) + self.log(cr, uid, id, message) return True - + def button_sale_confirm(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'confirm'}) for id in ids: @@ -87,30 +87,30 @@ class sale_journal(osv.osv): wf_service.trg_validate(uid, 'sale.order', saleid, 'order_confirm', cr) for (id,name) in self.name_get(cr, uid, ids): message = _('Sale orders of Journal') + " '" + name + "' "+ _("is confirmed") - self.log(cr, uid, id, message) + self.log(cr, uid, id, message) return True def button_open(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'open'}) for (id,name) in self.name_get(cr, uid, ids): message = _('Sale orders of Journal') + " '" + name + "' "+ _("is opened") - self.log(cr, uid, id, message) + self.log(cr, uid, id, message) return True - + def button_draft(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'draft'}) for (id,name) in self.name_get(cr, uid, ids): message = _('Sale orders of Journal') + " '" + name + "' "+ _("is in draft state") - self.log(cr, uid, id, message) + self.log(cr, uid, id, message) return True - + def button_close(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'done', 'date_validation':time.strftime('%Y-%m-%d')}) for (id,name) in self.name_get(cr, uid, ids): message = _('Sale orders of Journal') + " '" + name + "' "+ _("is closed") - self.log(cr, uid, id, message) + self.log(cr, uid, id, message) return True - + sale_journal() class picking_journal(osv.osv): From 2d79a9c14ec0fa2e518643a9819eebb84dfa75f7 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 22 Jun 2010 14:48:19 +0530 Subject: [PATCH 2/6] [FIX] sale_journal bzr revid: mra@mra-laptop-20100622091819-rjus247cnseppssd --- addons/sale/test/prepaid_sale_order.yml | 160 ++++++++++++------------ 1 file changed, 79 insertions(+), 81 deletions(-) diff --git a/addons/sale/test/prepaid_sale_order.yml b/addons/sale/test/prepaid_sale_order.yml index cd33b1bc73e..03f5ddf8aae 100644 --- a/addons/sale/test/prepaid_sale_order.yml +++ b/addons/sale/test/prepaid_sale_order.yml @@ -2,41 +2,41 @@ In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer. - I am going to sell my Mobile products to the customer with name Cleartrail -- +- I create View Account Type. -- +- !record {model: account.account.type, id: account_account_type_view0}: close_method: none code: View name: View sign: 1 -- +- I create Income Account Type. -- +- !record {model: account.account.type, id: account_account_type_income0}: close_method: unreconciled code: Income name: Income sign: 1 -- +- I create Expense Account Type. -- +- !record {model: account.account.type, id: account_account_type_expense0}: close_method: unreconciled code: Expense name: Expense sign: 1 -- +- I create Cash Account Type. -- +- !record {model: account.account.type, id: account_account_type_cash0}: close_method: balance code: Cash name: Cash sign: 1 -- +- I create Minimal Chart Account. -- +- !record {model: account.account, id: account_account_minimalchart0}: code: '0' company_id: base.main_company @@ -46,9 +46,9 @@ parent_right: 12 type: view user_type: account_account_type_view0 -- +- I create Payable Account. -- +- !record {model: account.account, id: account_account_payable1}: code: AP company_id: base.main_company @@ -60,12 +60,11 @@ reconcile: true type: payable user_type: account_account_type_expense0 -- +- I create Receivable Account. -- +- !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 @@ -74,9 +73,9 @@ reconcile: true type: receivable user_type: account_account_type_income0 -- +- I create Cash Account. -- +- !record {model: account.account, id: account_account_cash0}: code: C company_id: base.main_company @@ -87,9 +86,9 @@ parent_right: 7 type: other user_type: account_account_type_cash0 -- +- I create Purchases Account. -- +- !record {model: account.account, id: account_account_purchases0}: code: P company_id: base.main_company @@ -100,9 +99,9 @@ parent_right: 9 type: other user_type: account_account_type_expense0 -- +- I create Sales Account. -- +- !record {model: account.account, id: account_account_sales0}: code: S company_id: base.main_company @@ -113,9 +112,9 @@ parent_right: 11 type: other user_type: account_account_type_income0 -- +- I create Purchase Journal. -- +- !record {model: account.journal, id: account_journal_purchasejournal0}: code: PUJ company_id: base.main_company @@ -125,9 +124,9 @@ sequence_id: account.sequence_purchase_journal type: purchase view_id: account.account_journal_view -- +- I create Sale Journal. -- +- !record {model: account.journal, id: account_journal_salejournal0}: code: SAJ company_id: base.main_company @@ -137,84 +136,83 @@ sequence_id: account.sequence_sale_journal type: sale view_id: account.account_journal_view -- +- I create Bank Journal. -- +- !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 sequence_id: account.sequence_journal type: cash view_id: account.account_journal_bank_view -- +- I create ir.property for account payable. -- +- !record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}: company_id: base.main_company fields_id: account.field_res_partner_property_account_payable name: property_account_expense_categ value_reference: account.account,5 -- +- I create ir.property for account receivable. -- +- !record {model: ir.property, id: ir_property_propertyaccountincomecateg0}: company_id: base.main_company fields_id: account.field_res_partner_property_account_receivable name: property_account_income_categ value_reference: account.account,6 -- +- I create Partner category Customers. -- +- !record {model: res.partner.category, id: res_partner_category_customers0}: name: Customers - I create Cleartrail Customer. -- +- !record {model: res.partner, id: res_partner_cleartrail0}: category_id: - res_partner_category_customers0 name: Cleartrail -- +- I create contact address for Cleartrail. -- +- !record {model: res.partner.address, id: res_partner_address_1}: partner_id: res_partner_cleartrail0 street: onam plaza, 14 B palasia A B Road type: contact -- +- I create invoice address for Cleartrail. -- +- !record {model: res.partner.address, id: res_partner_address_2}: partner_id: res_partner_cleartrail0 street: sarda house 24 B palasia, A B Road type: invoice -- +- I create delivery address for Cleartrail. -- +- !record {model: res.partner.address, id: res_partner_address_3}: partner_id: res_partner_cleartrail0 street: sangam house 15 B palasia, A B Road type: delivery - Customer Cleartrail has specific instrument requirement regarding the stockable products. -- +- I define product category Mobile Products Sellable. -- +- !record {model: product.category, id: product_category_allproductssellable0}: name: Mobile Products Sellable - - -- - I define product category Mobile Services. -- + + +- + I define product category Mobile Services. +- !record {model: product.category, id: product_category_services0}: name: Mobile Services -- +- I define LG Viewty Smart product template. -- +- !record {model: product.template, id: product_template_lgviewtysmart0}: categ_id: product_category_allproductssellable0 cost_method: standard @@ -227,9 +225,9 @@ type: product uom_id: product.product_uom_unit uom_po_id: product.product_uom_unit -- +- I define LG Viewty Smart product. -- +- !record {model: product.product, id: product_product_lgviewtysmart0}: categ_id: product_category_allproductssellable0 cost_method: standard @@ -249,7 +247,7 @@ uom_po_id: product.product_uom_unit - I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid. -- +- !record {model: sale.order, id: sale_order_so1}: date_order: '2010-05-03' invoice_quantity: order @@ -273,11 +271,11 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop - - -- + + +- I confirm the sale order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so1} - I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery' @@ -285,67 +283,67 @@ !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so1")) assert so.invoice_ids, "Invoices has not been generated for sale_order_so1" -- +- I open the Invoice for the SO. -- +- !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) import netsvc - wf_service = netsvc.LocalService("workflow") + wf_service = netsvc.LocalService("workflow") invoice_ids = so.invoice_ids for invoice in invoice_ids: - wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) + wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - Creating a account invoice pay entry. -- +- !record {model: account.invoice.pay, id: account_invoice_pay_tst1}: amount: 85000.0 date: '2010-05-10' journal_id: sale.account_journal_bankjournal0 name: tst period_id: account.period_5 -- +- I pay the invoice. -- +- !python {model: account.invoice.pay}: | sale_order_obj = self.pool.get('sale.order') - so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) + so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz": False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, }) - - -- + + +- Creating an account invoice pay writeoff entry. -- +- !record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}: analytic_id: account.analytic_customers comment: Write-Off writeoff_acc_id: account.a_sale writeoff_journal_id: sale.account_journal_bankjournal0 - - -- + + +- Pay and Reconcile the Invoice. -- +- !python {model: account.invoice.pay.writeoff}: | sale_order_obj = self.pool.get('sale.order') - so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) + so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")], {"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id }) - - + + - I will verify the picking associated with the sale order sale_order_so1 -- +- !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so1")) assert so.picking_ids,"Picking has not been generated for sale_order_so1" -- +- Products are delivered to the Cleartrail Customer. -- +- !python {model: stock.picking }: | import time sale_order_obj = self.pool.get('sale.order') @@ -371,9 +369,9 @@ - !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') - so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) + so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')]) - + if picking_id: pick = self.browse(cr,uid,picking_id[0]) assert (pick.state) =='done', "Picking for SO is not in done state." From f7f5ecf2c003dbc6c8f2a05ac57d32cd18697217 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 22 Jun 2010 15:48:03 +0530 Subject: [PATCH 3/6] [IMP] sale_margin misc changes bzr revid: mra@mra-laptop-20100622101803-2e0qvrc8wfzz70ii --- addons/sale_margin/sale_margin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 77f7be55342..c390bf769e2 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -25,7 +25,8 @@ from tools import config class sale_order_line(osv.osv): _name = "sale.order.line" _inherit = "sale.order.line" - def _product_margin(self, cr, uid, ids, field_name, arg, context): + + def _product_margin(self, cr, uid, ids, field_name, arg, context=None): res = {} for line in self.browse(cr, uid, ids): res[line.id] = 0 @@ -46,7 +47,7 @@ sale_order_line() class sale_order(osv.osv): _inherit = "sale.order" - def _product_margin(self, cr, uid, ids, field_name, arg, context): + def _product_margin(self, cr, uid, ids, field_name, arg, context=None): result = {} for sale in self.browse(cr, uid, ids, context=context): result[sale.id] = 0.0 @@ -69,14 +70,13 @@ class stock_picking(osv.osv): def create_invoice(self, cr, uid, ids, *args): # need to carify with new requirement - res = False invoice_ids = [] margin_deduce = 0.0 picking_obj = self.pool.get('stock.picking') picking_obj.write(cr, uid, ids, {'invoice_state' : '2binvoiced'}) res = picking_obj.action_invoice_create(cr, uid, ids, type='out_invoice', context={}) invoice_ids = res.values() - picking_obj.write(cr, uid, ids,{'invoice_ids':[[6,0,invoice_ids]]}) + picking_obj.write(cr, uid, ids,{'invoice_ids': [[6,0,invoice_ids]]}) return True stock_picking() From 14fb174a684c6a9541992bc29c661013d59aabfc Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 22 Jun 2010 15:58:20 +0530 Subject: [PATCH 4/6] [IMP] sale_mrp: misc change bzr revid: mra@mra-laptop-20100622102820-v7kl8bvfi1rajaai --- addons/sale_mrp/__openerp__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale_mrp/__openerp__.py b/addons/sale_mrp/__openerp__.py index 9ac55911983..1496e46c87e 100644 --- a/addons/sale_mrp/__openerp__.py +++ b/addons/sale_mrp/__openerp__.py @@ -25,9 +25,10 @@ 'version': '1.0', 'category': 'Generic Modules/Sales & MRP', 'description': """ - This module provides facility to the user to install mrp and sale modules - at a time. It is basically used when we want to keep track of production + This module provides facility to the user to install mrp and sale modules + at a time. It is basically used when we want to keep track of production orders generated from sale orders. + It adds sale name and sale Reference on production order """, 'author': 'Tiny', 'website': 'http://www.openerp.com', From 8a0d7d8afd2a2849a41b64d8ececa06fde5d96db Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Tue, 22 Jun 2010 16:02:55 +0530 Subject: [PATCH 5/6] [IMP]:improved accounting wizards bzr revid: pap@tinyerp.co.in-20100622103255-mroqq9v3zw11hs2s --- addons/account/account_menuitem.xml | 2 +- .../wizard/account_balance_report_view.xml | 5 +- .../wizard/account_central_journal_view.xml | 19 +++++--- ...nt_compare_account_balance_report_view.xml | 3 +- .../wizard/account_general_journal_view.xml | 17 ++++--- .../account_general_ledger_report_view.xml | 3 ++ .../account_partner_balance_report_view.xml | 5 +- .../wizard/account_print_journal_view.xml | 47 +++++++++++++++---- .../wizard/account_third_party_ledger.xml | 5 +- addons/account/wizard/account_vat_view.xml | 9 +++- 10 files changed, 85 insertions(+), 30 deletions(-) diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index dd577f98458..51c26706446 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -11,7 +11,7 @@ - + diff --git a/addons/account/wizard/account_balance_report_view.xml b/addons/account/wizard/account_balance_report_view.xml index f50cce039cc..77c615611d3 100644 --- a/addons/account/wizard/account_balance_report_view.xml +++ b/addons/account/wizard/account_balance_report_view.xml @@ -8,6 +8,7 @@ form
+ @@ -30,10 +31,12 @@ -