diff --git a/addons/account/account.py b/addons/account/account.py index bf5e25a6f69..1520c4f0646 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -154,7 +154,7 @@ class account_account_type(osv.osv): ('expense','Profit & Loss (Expense Accounts)'), ('asset','Balance Sheet (Assets Accounts)'), ('liability','Balance Sheet (Liability Accounts)') - ],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)", required=True), + ],'P&L / BS Category', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)", required=True), 'note': fields.text('Description'), } _defaults = { diff --git a/addons/account/account_invoice_workflow.xml b/addons/account/account_invoice_workflow.xml index a6b7fe4a78e..2af1e192a9b 100644 --- a/addons/account/account_invoice_workflow.xml +++ b/addons/account/account_invoice_workflow.xml @@ -2,11 +2,6 @@ - - - Assign this role to the persons that should have the rights to confirm a draft invoice. - - account.invoice.basic account.invoice diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index 9a733d8ad5f..44acc341d8e 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -4,9 +4,6 @@ !record {model: account.tax.code, id: account_tax_code_0}: name : Tax Code Test sign : 1.00 -- - - - In order to test the 'Validate Journal Entries' wizard in OpenERP, I created an account move diff --git a/addons/account_budget/account_budget_workflow.xml b/addons/account_budget/account_budget_workflow.xml index 16997d694f2..39762375763 100644 --- a/addons/account_budget/account_budget_workflow.xml +++ b/addons/account_budget/account_budget_workflow.xml @@ -2,11 +2,6 @@ - - Crossovered Budget Validation - Assign this role to the persons that should have the rights to Approve a confirm Budgets. - - diff --git a/addons/delivery/test/delivery_report.yml b/addons/delivery/test/delivery_report.yml index 53b06a9d36a..b66528ea18c 100644 --- a/addons/delivery/test/delivery_report.yml +++ b/addons/delivery/test/delivery_report.yml @@ -12,6 +12,7 @@ invoice_state: none move_lines: - company_id: base.main_company + date: '2010-05-11 15:18:57' location_dest_id: stock.stock_location_customers location_id: stock.stock_location_stock name: HP CD writers diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml deleted file mode 100644 index 9225cbca66b..00000000000 --- a/addons/delivery/test/delivery_test.yml +++ /dev/null @@ -1,155 +0,0 @@ -- - In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method - And there are two methods for doing that - Delivery based on order quantities, - Delivery based on delivered quantities. -- - I create the partner associated with the transport. -- - I create partner. -- - !record {model: res.partner, id: res_partner_thepost0}: - address: - - country_id: base.in - name: Micro Link - credit_limit: 0.0 - name: The Post - property_account_payable: account.a_pay - property_account_receivable: account.a_recv -- - - I create associated product for delivery. -- - !record {model: product.product, id: product_product_deliverybypost0}: - categ_id: product.product_category_services - cost_method: standard - mes_type: fixed - name: Delivery Product - procure_method: make_to_stock - supply_method: buy - type: service - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - warranty: 0.0 -- - I create the Delivery Method. -- - !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: - name: The OpenERP Experss - partner_id: res_partner_thepost0 - product_id: product_product_deliverybypost0 -- - I create a delivery grid record and define the region for which the tariffs in the grid will be applicable. - Then set the condition for which this rule is applicable. -- - !record {model: delivery.grid, id: delivery_grid_weight0}: - carrier_id: delivery_carrier_theopenerpexperss0 - line_ids: - - list_price: 120.0 - max_value: 250.0 - name: Weight of product - operator: <= - standard_price: 60.0 - type: weight - price_type: fixed - variable_factor: weight - - list_price: 0.0 - max_value: 500.0 - name: Price >= 500 - operator: <= - standard_price: 20.0 - type: price - price_type: fixed - variable_factor: weight - country_ids: - - base.id - - base.be - - base.in - - base.io - - name: Weight - sequence: 1 -- - To check the Delivery based on order quantities , I have created sale order and picking_policy is direct . -- - !record {model: sale.order, id: sale_order_so0}: - date_order: '2010-05-11' - invoice_quantity: order - name: Test/delivery - order_line: - - name: '[PC1] Basic PC' - price_unit: 450.0 - product_uom: product.product_uom_unit - product_uom_qty: 10.0 - state: draft - delay: 2.0 - product_id: product.product_product_pc1 - product_uos_qty: 10.0 - th_weight: 0.0 - type: make_to_stock - order_policy: manual - partner_id: base.res_partner_agrolait - partner_invoice_id: base.res_partner_address_8 - partner_order_id: base.res_partner_address_8 - partner_shipping_id: base.res_partner_address_8 - picking_policy: direct - pricelist_id: product.list0 - shop_id: sale.shop -- - I create delivery.sale.order record. -- - !record {model: delivery.sale.order, id: delivery_sale_order_0}: - carrier_id: delivery_carrier_theopenerpexperss0 -- - To add the delivery charges on the quotation, I click on Delivery costs button and select the carrier. -- - !python {model: delivery.sale.order}: | - self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model": - "sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")], - "active_id": ref("sale_order_so0"), }) -- - I confirm the sale order. -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0} -- - To check the Invoicing based on deliveries.I create new sale order and picking_policy is Complete Delivery. -- - !record {model: sale.order, id: sale_order_test_complete0}: - name: Test/Complete Deliver - carrier_id: delivery.delivery_carrier_theopenerpexperss0 - invoice_quantity: procurement - order_line: - - name: '[PC1] Basic PC' - price_unit: 450.0 - product_uom: product.product_uom_unit - product_uom_qty: 10.0 - state: draft - delay: 2.0 - product_id: product.product_product_pc1 - product_uos_qty: 10.0 - th_weight: 0.0 - type: make_to_stock - partner_id: base.res_partner_4 - partner_order_id: base.res_partner_address_7 - partner_invoice_id: base.res_partner_address_7 - partner_shipping_id: base.res_partner_address_7 - pricelist_id: product.list0 - order_policy: picking -- - I confirm the sale order. -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0} -- - I Create stock.invoice.onshipping -- - !record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}: - journal_id: account.sales_journal - type: out_invoice -- - I Create Invoice form picking. -- - !python {model: stock.invoice.onshipping}: | - so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) - self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US", - "tz": False, "active_model": "stock.picking", "contact_display": "partner", - "active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id }) diff --git a/addons/email_template/email_template_workflow.xml b/addons/email_template/email_template_workflow.xml index 1a6a73cca77..84a58815b5e 100644 --- a/addons/email_template/email_template_workflow.xml +++ b/addons/email_template/email_template_workflow.xml @@ -2,10 +2,6 @@ - - Email Administrator - - Email Template Workflow email_template.account diff --git a/addons/hr/process/hr_process.xml b/addons/hr/process/hr_process.xml index 1471fbe5352..8bc8e5e49b9 100644 --- a/addons/hr/process/hr_process.xml +++ b/addons/hr/process/hr_process.xml @@ -53,7 +53,7 @@ - + diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 1ad05582d47..440afa2894e 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -146,8 +146,8 @@ - - + + @@ -157,9 +157,12 @@ - + + + + diff --git a/addons/hr_expense/hr_expense_workflow.xml b/addons/hr_expense/hr_expense_workflow.xml index 547129e89e2..192533e67de 100644 --- a/addons/hr_expense/hr_expense_workflow.xml +++ b/addons/hr_expense/hr_expense_workflow.xml @@ -2,16 +2,6 @@ - - - - Human Resources - Expenses - - - - Human Resources - Expenses invoice - - diff --git a/addons/hr_expense/report/expense.rml b/addons/hr_expense/report/expense.rml index 9754f9debe2..dbc3c09d9c6 100644 --- a/addons/hr_expense/report/expense.rml +++ b/addons/hr_expense/report/expense.rml @@ -259,7 +259,7 @@ - [[ o.note or removeParentNode('para')]] + [[ setTag('para','xpre') ]] [[ o.note or '' ]] diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py index f06b41e69da..308f03ba293 100644 --- a/addons/hr_holidays/__openerp__.py +++ b/addons/hr_holidays/__openerp__.py @@ -43,7 +43,7 @@ HR / Employees / Employees then select the ones you want to choose, click on the print icon and select the option 'Print Summary of Employee's Holidays' - - The wizard allows you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones. These states must be set up by a user from the group 'HR' and with the role 'holidays'. You can define these features in the security tab from the user data in + - The wizard allows you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones. These states must be set up by a user from the group 'HR'. You can define these features in the security tab from the user data in Administration / Users / Users for example, you maybe will do it for the user 'admin' . diff --git a/addons/hr_holidays/hr_holidays_workflow.xml b/addons/hr_holidays/hr_holidays_workflow.xml index de2bd9f1131..9d5338a801f 100644 --- a/addons/hr_holidays/hr_holidays_workflow.xml +++ b/addons/hr_holidays/hr_holidays_workflow.xml @@ -2,12 +2,6 @@ - - - - Leaves Manager - - diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py index 7b114d46387..d00ee91a304 100644 --- a/addons/hr_timesheet_sheet/__openerp__.py +++ b/addons/hr_timesheet_sheet/__openerp__.py @@ -49,13 +49,14 @@ The validation can be configured in the company: 'init_xml': [], 'update_xml': [ 'security/ir.model.access.csv', - 'security/hr_timesheet_data.xml', + 'security/hr_timesheet_sheet_security.xml', 'hr_timesheet_sheet_view.xml', 'hr_timesheet_workflow.xml', 'process/hr_timesheet_sheet_process.xml', 'board_hr_timesheet_view.xml', 'report/hr_timesheet_report_view.xml', 'wizard/hr_timesheet_current_view.xml', + 'hr_timesheet_sheet_data.xml' ], 'demo_xml': ['hr_timesheet_sheet_demo.xml', diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index ce074715888..44bda56739f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -334,11 +334,16 @@ class hr_timesheet_sheet(osv.osv): return time.strftime('%Y-12-31') return time.strftime('%Y-%m-%d') + def _default_employee(self,cr, uid, context=None): + emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)], context=context) + return emp_ids and emp_ids[0] or False + _defaults = { 'date_from' : _default_date_from, 'date_current' : lambda *a: time.strftime('%Y-%m-%d'), 'date_to' : _default_date_to, 'state': 'new', + 'employee_id': _default_employee, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c) } diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml new file mode 100644 index 00000000000..e7fae82ec70 --- /dev/null +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + My Timesheet + + + STOCK_JUSTIFY_FILL + + + + + \ No newline at end of file diff --git a/addons/hr_timesheet_sheet/hr_timesheet_workflow.xml b/addons/hr_timesheet_sheet/hr_timesheet_workflow.xml index b664fd79c96..1afc8909323 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_workflow.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_workflow.xml @@ -2,12 +2,6 @@ - - - - Timesheets validation - - diff --git a/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml b/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml index 7c259016fca..628cc2097ae 100644 --- a/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml +++ b/addons/hr_timesheet_sheet/process/hr_timesheet_sheet_process.xml @@ -96,10 +96,6 @@ Process Transition --> - - - - diff --git a/addons/hr_timesheet_sheet/security/hr_timesheet_data.xml b/addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml similarity index 100% rename from addons/hr_timesheet_sheet/security/hr_timesheet_data.xml rename to addons/hr_timesheet_sheet/security/hr_timesheet_sheet_security.xml diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py index e6e08e83b01..2b869e56306 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -81,7 +81,7 @@ class l10n_be_vat_declaration(osv.osv_memory): account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context) send_ref = str(obj_company.partner_id.id) + str(account_period.date_start[5:7]) + str(account_period.date_stop[:4]) - data_of_file = '\n' + data_of_file = '\n' data_of_file +='\n\t\n\t\t'+str(vat_no)+'\n\t\t'+ obj_company.name +'\n\t\t
'+address+'
' data_of_file +='\n\t\t'+post_code+'\n\t\t'+city+'\n\t\t'+country_code+'\n\t\t'+send_ref+'\n\t
' data_of_file +='\n\t\n\t\t1\n\t\t'+((vat_no and str(vat_no[2:])) or '')+'\n\t\t\n\t\t\t' @@ -127,4 +127,4 @@ class l10n_be_vat_declaration(osv.osv_memory): l10n_be_vat_declaration() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/olap/olap.py b/addons/olap/olap.py index b76adc66b08..ace43d212a1 100644 --- a/addons/olap/olap.py +++ b/addons/olap/olap.py @@ -1925,8 +1925,7 @@ class bi_auto_configure_wizard(osv.osv_memory): table_new = dbtab_obj.write(cr, uid, tables['id'], end_user_name) if not(tables['table_db_name'].startswith('ir') or \ tables['table_db_name'].startswith('wkf') or \ - tables['table_db_name'].startswith('res_groups') or \ - tables['table_db_name'].startswith('res_role')) and \ + tables['table_db_name'].startswith('res_groups')) and \ tables['table_db_name'] not in ['inherit', 'user_rule_group_rel',\ 'group_rule_group_rel']: vals = {} @@ -1999,8 +1998,8 @@ class bi_auto_configure_wizard(osv.osv_memory): table['table_db_name'].startswith('wkf')) or \ (table['table_db_name'].startswith('res_groups')) or \ (table['table_db_name'] in \ - ['inherit', 'res_roles', 'user_rule_group_rel', \ - 'res_roles_users_rel', 'group_rule_group_rel']): + ['inherit', 'user_rule_group_rel', \ + 'group_rule_group_rel']): vals['hide'] = True vals['active'] = False make_id.append(table['id']) diff --git a/addons/point_of_sale/pos_workflow.xml b/addons/point_of_sale/pos_workflow.xml index 189b38e348f..c325c4951c9 100644 --- a/addons/point_of_sale/pos_workflow.xml +++ b/addons/point_of_sale/pos_workflow.xml @@ -7,12 +7,6 @@ True
- - - - POS - Confirmation - - diff --git a/addons/process/process.py b/addons/process/process.py index 7bb8593d467..479b8748ff3 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -19,9 +19,8 @@ # ############################################################################## -import netsvc -import pooler, tools - +import pooler +import tools from osv import fields, osv class Env(dict): @@ -139,7 +138,7 @@ class process_process(osv.osv): if node.model_id and node.model_id.model == res_model: try: data['active'] = eval(node.model_states, expr_context) - except Exception, e: + except Exception: pass if not data['active']: @@ -169,23 +168,19 @@ class process_process(osv.osv): button['state'] = b.state button['action'] = b.action buttons.append(button) - data['roles'] = roles = [] + data['groups'] = groups = [] for r in tr.transition_ids: - if r.role_id: - role = {} - role['name'] = r.role_id.name - roles.append(role) - for r in tr.role_ids: - role = {} - role['name'] = r.name - roles.append(role) + if r.group_id: + groups.append({'name': r.group_id.name}) + for r in tr.group_ids: + groups.append({'name': r.name}) transitions[tr.id] = data # now populate resource information def update_relatives(nid, ref_id, ref_model): relatives = [] - for tid, tr in transitions.items(): + for dummy, tr in transitions.items(): if tr['source'] == nid: relatives.append(tr['target']) if tr['target'] == nid: @@ -349,7 +344,7 @@ class process_transition(osv.osv): 'target_node_id': fields.many2one('process.node', 'Target Node', required=True, ondelete='cascade'), 'action_ids': fields.one2many('process.transition.action', 'transition_id', 'Buttons'), 'transition_ids': fields.many2many('workflow.transition', 'process_transition_ids', 'ptr_id', 'wtr_id', 'Workflow Transitions'), - 'role_ids': fields.many2many('res.roles', 'process_transition_roles_rel', 'tid', 'rid', 'Roles'), + 'group_ids': fields.many2many('res.groups', 'process_transition_group_rel', 'tid', 'rid', string='Required Groups'), 'note': fields.text('Description', translate=True), } process_transition() diff --git a/addons/process/process_demo.xml b/addons/process/process_demo.xml index 41a4588fc0f..e0333feeefa 100644 --- a/addons/process/process_demo.xml +++ b/addons/process/process_demo.xml @@ -151,8 +151,6 @@ - -
diff --git a/addons/process/process_view.xml b/addons/process/process_view.xml index 1a5714437b8..d158dd83425 100644 --- a/addons/process/process_view.xml +++ b/addons/process/process_view.xml @@ -282,9 +282,12 @@ - + + + + diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 3c9bff9be9c..4d54fa256a8 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -238,7 +238,7 @@
= proc.date_planned): - wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr) - else: - offset += 1 - report_later += 1 - for proc in procurement_obj.browse(cr, uid, ids): - if proc.state == 'exception': - report.append('PROC %d: on order - %3.2f %-5s - %s' % \ - (proc.id, proc.product_qty, proc.product_uom.name, - proc.product_id.name)) - report_except += 1 - report_total += 1 + try: if use_new_cursor: - cr.commit() + cr = pooler.get_db(use_new_cursor).cursor() + wf_service = netsvc.LocalService("workflow") + + procurement_obj = self.pool.get('procurement.order') if not ids: - break - - offset = 0 - ids = [] - while True: - report_ids = [] - ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset) - for proc in procurement_obj.browse(cr, uid, ids): - if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) : - wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr) - report_ids.append(proc.id) - else: - report_later += 1 - report_total += 1 - for proc in procurement_obj.browse(cr, uid, report_ids): - if proc.state == 'exception': - report.append('PROC %d: from stock - %3.2f %-5s - %s' % \ - (proc.id, proc.product_qty, proc.product_uom.name, - proc.product_id.name,)) - report_except += 1 + ids = procurement_obj.search(cr, uid, [], order="date_planned") + for id in ids: + wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr) if use_new_cursor: cr.commit() - offset += len(ids) - if not ids: break - end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss') - if uid: - request = self.pool.get('res.request') - summary = '''Here is the procurement scheduling report. + company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id + maxdate = (DateTime.now() + DateTime.RelativeDateTime(days=company.schedule_range)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss') + offset = 0 + report = [] + report_total = 0 + report_except = 0 + report_later = 0 + while True: + cr.execute("select id from procurement_order where state='confirmed' and procure_method='make_to_order' order by priority,date_planned limit 500 offset %s", (offset,)) + ids = map(lambda x: x[0], cr.fetchall()) + for proc in procurement_obj.browse(cr, uid, ids): + if maxdate >= proc.date_planned: + wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr) + else: + offset += 1 + report_later += 1 + for proc in procurement_obj.browse(cr, uid, ids): + if proc.state == 'exception': + report.append('PROC %d: on order - %3.2f %-5s - %s' % \ + (proc.id, proc.product_qty, proc.product_uom.name, + proc.product_id.name)) + report_except += 1 + report_total += 1 + if use_new_cursor: + cr.commit() + if not ids: + break + offset = 0 + ids = [] + while True: + report_ids = [] + ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset) + for proc in procurement_obj.browse(cr, uid, ids): + if maxdate >= proc.date_planned: + wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr) + report_ids.append(proc.id) + else: + report_later += 1 + report_total += 1 + for proc in procurement_obj.browse(cr, uid, report_ids): + if proc.state == 'exception': + report.append('PROC %d: from stock - %3.2f %-5s - %s' % \ + (proc.id, proc.product_qty, proc.product_uom.name, + proc.product_id.name,)) + report_except += 1 + if use_new_cursor: + cr.commit() + offset += len(ids) + if not ids: break + end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss') + if uid: + request = self.pool.get('res.request') + summary = '''Here is the procurement scheduling report. + + Start Time: %s + End Time: %s + Total Procurements processed: %d + Procurements with exceptions: %d + Skipped Procurements (scheduled date outside of scheduler range) %d + + Exceptions:\n'''% (start_date, end_date, report_total, report_except, report_later) + summary += '\n'.join(report) + request.create(cr, uid, + {'name': "Procurement Processing Report.", + 'act_from': uid, + 'act_to': uid, + 'body': summary, + }) - Computation Started; %s - Computation Finished; %s - - Total procurement: %d - Exception procurement: %d - Not run now procurement: %d - - Exceptions; - '''% (start_date, end_date, report_total, report_except, report_later) - summary += '\n'.join(report) - request.create(cr, uid, - {'name': "Procurement calculation report.", - 'act_from': uid, - 'act_to': uid, - 'body': summary, - }) - if use_new_cursor: - cr.commit() - cr.close() + if use_new_cursor: + cr.commit() + finally: + if use_new_cursor: + try: + cr.close() + except Exception: + pass return {} def create_automatic_op(self, cr, uid, context=None): diff --git a/addons/product/product.py b/addons/product/product.py index 04a5232b1ea..3e4d48e5c74 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -24,7 +24,7 @@ import decimal_precision as dp import math from _common import rounding - +import re from tools.translate import _ def is_pair(x): @@ -502,6 +502,11 @@ class product_product(osv.osv): if not len(ids): ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context) ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) + if not len(ids): + ptrn=re.compile('(\[(.*?)\])') + res = ptrn.search(str(name)) + if res: + ids = self.search(cr, user, [('default_code','ilike',res.group(2))]+ args, limit=limit, context=context) else: ids = self.search(cr, user, args, limit=limit, context=context) result = self.name_get(cr, user, ids, context) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index fb3d8f0b078..ea9cacd7979 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -28,9 +28,6 @@ class stock_move(osv.osv): 'Purchase Order Line', ondelete='set null', select=True, readonly=True), } - _defaults = { - 'purchase_line_id': False - } def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None): """ @@ -73,47 +70,39 @@ class stock_picking(osv.osv): return picking.note + '\n' + picking.purchase_id.notes else: return picking.purchase_id.notes - return super(stock_picking, self)._get_comment_invoice(cursor, user, - picking) + return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.purchase_line_id: return move_line.purchase_line_id.price_unit - return super(stock_picking, self)._get_price_unit_invoice(cursor, - user, move_line, type) + return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type) def _get_discount_invoice(self, cursor, user, move_line): if move_line.purchase_line_id: return 0.0 - return super(stock_picking, self)._get_discount_invoice(cursor, user, - move_line) + return super(stock_picking, self)._get_discount_invoice(cursor, user, move_line) def _get_taxes_invoice(self, cursor, user, move_line, type): if move_line.purchase_line_id: return [x.id for x in move_line.purchase_line_id.taxes_id] - return super(stock_picking, self)._get_taxes_invoice(cursor, user, - move_line, type) + return super(stock_picking, self)._get_taxes_invoice(cursor, user, move_line, type) def _get_account_analytic_invoice(self, cursor, user, picking, move_line): if move_line.purchase_line_id: return move_line.purchase_line_id.account_analytic_id.id - return super(stock_picking, self)._get_account_analytic_invoice(cursor, - user, picking, move_line) + return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line) def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id): if move_line.purchase_line_id: invoice_line_obj = self.pool.get('account.invoice.line') - invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.purchase_line_id.notes,}) - return super(stock_picking, self)._invoice_line_hook(cursor, user, - move_line, invoice_line_id) + invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.purchase_line_id.notes,}) + return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id) def _invoice_hook(self, cursor, user, picking, invoice_id): purchase_obj = self.pool.get('purchase.order') if picking.purchase_id: - purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id, - }) - return super(stock_picking, self)._invoice_hook(cursor, user, - picking, invoice_id) + purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id,}) + return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id) stock_picking() @@ -132,11 +121,13 @@ class stock_partial_picking(osv.osv_memory): pick_obj = self.pool.get('stock.picking') res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context) for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])): + has_product_cost = (pick.type == 'in' and pick.purchase_id) for m in pick.move_lines: - if (m.product_id.cost_method == 'average'): - if pick.type == 'in' and pick.purchase_id and m.purchase_line_id: - res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit - res['move%s_product_currency'%(m.id)] = pick.purchase_id.pricelist_id.currency_id.id + if has_product_cost and m.product_id.cost_method == 'average' and m.purchase_line_id: + # We use the original PO unit purchase price as the basis for the cost, expressed + # in the currency of the PO (i.e the PO's pricelist currency) + res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit + res['move%s_product_currency'%(m.id)] = pick.purchase_id.pricelist_id.currency_id.id return res stock_partial_picking() @@ -154,10 +145,12 @@ class stock_partial_move(osv.osv_memory): res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context) move_obj = self.pool.get('stock.move') for m in move_obj.browse(cr, uid, context.get('active_ids', [])): - if (m.product_id.cost_method == 'average'): - if m.picking_id.type == 'in' and m.purchase_line_id and m.picking_id.purchase_id: + if m.picking_id.type == 'in' and m.product_id.cost_method == 'average' \ + and m.purchase_line_id and m.picking_id.purchase_id: + # We use the original PO unit purchase price as the basis for the cost, expressed + # in the currency of the PO (i.e the PO's pricelist currency) res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit - res['move%s_product_currency'%(m.id)] = m.picking_id.purchase_id.pricelist_id.currency_id.id + res['move%s_product_currency'%(m.id)] = m.picking_id.purchase_id.pricelist_id.currency_id.id return res stock_partial_move() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/process/sale_process.xml b/addons/sale/process/sale_process.xml index e20cf959c9b..83d80381c09 100644 --- a/addons/sale/process/sale_process.xml +++ b/addons/sale/process/sale_process.xml @@ -133,10 +133,6 @@ Process Transition --> - - - - diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 0bb47110213..ab4b165201a 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -26,28 +26,12 @@ class stock_move(osv.osv): _columns = { 'sale_line_id': fields.many2one('sale.order.line', 'Sale Order Line', ondelete='set null', select=True, readonly=True), } - _defaults = { - 'sale_line_id': False - } - def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None): - """ - Overrides the default stock valuation to take into account the currency that was specified - on the sale order in case the valuation data was not directly specified during picking - confirmation. - """ - reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context) - if move.product_id.cost_method != 'average' or not move.price_unit: - # no average price costing or cost not specified during picking validation, we will - # plug the sale line values if they are found. - if move.sale_line_id and move.picking_id.sale_id.pricelist_id: - reference_amount, reference_currency_id = move.sale_line_id.price_unit, move.picking_id.sale_id.pricelist_id.currency_id.id - return reference_amount, reference_currency_id def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None): res=super(stock_move, self)._create_chained_picking(cr, uid, pick_name,picking,ptype,move, context=context) if picking.sale_id: - picking_obj = self.pool.get('stock.picking').write(cr,uid,[res],{'sale_id':picking.sale_id.id}) - return res + self.pool.get('stock.picking').write(cr,uid,[res],{'sale_id':picking.sale_id.id}) + return res stock_move() class stock_picking(osv.osv): @@ -66,11 +50,9 @@ class stock_picking(osv.osv): return super(stock_picking, self).get_currency_id(cursor, user, picking) def _get_payment_term(self, cursor, user, picking): - res = {} if picking.sale_id and picking.sale_id.payment_term: return picking.sale_id.payment_term.id - return super(stock_picking, self)._get_payment_term(cursor, - user, picking) + return super(stock_picking, self)._get_payment_term(cursor, user, picking) def _get_address_invoice(self, cursor, user, picking): res = {} @@ -78,47 +60,42 @@ class stock_picking(osv.osv): res['contact'] = picking.sale_id.partner_order_id.id res['invoice'] = picking.sale_id.partner_invoice_id.id return res - return super(stock_picking, self)._get_address_invoice(cursor, - user, picking) + return super(stock_picking, self)._get_address_invoice(cursor, user, picking) def _get_comment_invoice(self, cursor, user, picking): if picking.note or (picking.sale_id and picking.sale_id.note): return picking.note or picking.sale_id.note - return super(stock_picking, self)._get_comment_invoice(cursor, user, - picking) + return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id: return move_line.sale_line_id.price_unit - return super(stock_picking, self)._get_price_unit_invoice(cursor, - user, move_line, type) + return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type) def _get_discount_invoice(self, cursor, user, move_line): if move_line.sale_line_id: return move_line.sale_line_id.discount - return super(stock_picking, self)._get_discount_invoice(cursor, user, - move_line) + return super(stock_picking, self)._get_discount_invoice(cursor, user, move_line) def _get_taxes_invoice(self, cursor, user, move_line, type): if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id: return [x.id for x in move_line.sale_line_id.tax_id] - return super(stock_picking, self)._get_taxes_invoice(cursor, user, - move_line, type) + return super(stock_picking, self)._get_taxes_invoice(cursor, user, move_line, type) def _get_account_analytic_invoice(self, cursor, user, picking, move_line): if picking.sale_id: return picking.sale_id.project_id.id - return super(stock_picking, self)._get_account_analytic_invoice(cursor, - user, picking, move_line) + return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line) def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id): sale_line_obj = self.pool.get('sale.order.line') if move_line.sale_line_id: - sale_line_obj.write(cursor, user, [move_line.sale_line_id.id], {'invoiced':True, - 'invoice_lines': [(4, invoice_line_id)], - }) - return super(stock_picking, self)._invoice_line_hook(cursor, user, - move_line, invoice_line_id) + sale_line_obj.write(cursor, user, [move_line.sale_line_id.id], + { + 'invoiced': True, + 'invoice_lines': [(4, invoice_line_id)], + }) + return super(stock_picking, self)._invoice_line_hook(cursor, user, move_line, invoice_line_id) def _invoice_hook(self, cursor, user, picking, invoice_id): sale_obj = self.pool.get('sale.order') @@ -126,8 +103,7 @@ class stock_picking(osv.osv): sale_obj.write(cursor, user, [picking.sale_id.id], { 'invoice_ids': [(4, invoice_id)], }) - return super(stock_picking, self)._invoice_hook(cursor, user, - picking, invoice_id) + return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id) def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): @@ -227,47 +203,4 @@ class stock_picking(osv.osv): stock_picking() -class stock_partial_picking(osv.osv_memory): - _inherit = 'stock.partial.picking' - - def default_get(self, cr, uid, fields, context=None): - """ To get default values for the object. - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param fields: List of fields for which we want default values - @param context: A standard dictionary - @return: A dictionary which of fields with values. - """ - pick_obj = self.pool.get('stock.picking') - res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context) - for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])): - for m in pick.move_lines: - if (m.product_id.cost_method == 'average'): - if pick.type == 'out' and pick.sale_id and m.sale_line_id: - res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit - res['move%s_product_currency'%(m.id)] = pick.sale_id.pricelist_id.currency_id.id - return res -stock_partial_picking() - -class stock_partial_move(osv.osv_memory): - _inherit = "stock.partial.move" - def default_get(self, cr, uid, fields, context=None): - """ To get default values for the object. - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param fields: List of fields for which we want default values - @param context: A standard dictionary - @return: A dictionary which of fields with values. - """ - res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context) - move_obj = self.pool.get('stock.move') - for m in move_obj.browse(cr, uid, context.get('active_ids', [])): - if (m.product_id.cost_method == 'average'): - if m.picking_id.type == 'out' and m.sale_line_id and m.picking_id.sale_id: - res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit - res['move%s_product_currency'%(m.id)] = m.picking_id.sale_id.pricelist_id.currency_id.id - return res -stock_partial_move() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5717143c1a6..1c5ee23a0dc 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -25,7 +25,6 @@ from operator import itemgetter from itertools import groupby from osv import fields, osv -from tools import config from tools.translate import _ import netsvc import tools @@ -731,21 +730,29 @@ class stock_picking(osv.osv): 'button_confirm', cr) return True - def draft_validate(self, cr, uid, ids, *args): + def draft_validate(self, cr, uid, ids, context=None): """ Validates picking directly from draft state. @return: True """ + if context is None: + context = {} wf_service = netsvc.LocalService("workflow") self.draft_force_assign(cr, uid, ids) for pick in self.browse(cr, uid, ids): move_ids = [x.id for x in pick.move_lines] self.pool.get('stock.move').force_assign(cr, uid, move_ids) wf_service.trg_write(uid, 'stock.picking', pick.id, cr) - - self.action_move(cr, uid, [pick.id]) - wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr) - return True - + context.update({'active_ids':ids}) + return { + 'name': 'Make Picking', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'stock.partial.picking', + 'type': 'ir.actions.act_window', + 'target': 'new', + 'nodestroy': True, + 'context':context + } def cancel_assign(self, cr, uid, ids, *args): """ Cancels picking and moves. @return: True @@ -1101,8 +1108,6 @@ class stock_picking(osv.osv): delivery moves with product_id, product_qty, uom @return: Dictionary of values """ - import pdb - #pdb.set_trace() if context is None: context = {} else: @@ -1112,15 +1117,10 @@ class stock_picking(osv.osv): product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') uom_obj = self.pool.get('product.uom') - price_type_obj = self.pool.get('product.price.type') sequence_obj = self.pool.get('ir.sequence') wf_service = netsvc.LocalService("workflow") - partner_id = partial_datas.get('partner_id', False) - address_id = partial_datas.get('address_id', False) - delivery_date = partial_datas.get('delivery_date', False) for pick in self.browse(cr, uid, ids, context=context): new_picking = None - new_moves = [] complete, too_many, too_few = [], [], [] move_product_qty = {} prodlot_ids = {} @@ -1194,7 +1194,7 @@ class stock_picking(osv.osv): prodlot_id = prodlot_ids[move.id] if prodlot_id: defaults.update(prodlot_id=prodlot_id) - new_obj = move_obj.copy(cr, uid, move.id, defaults) + move_obj.copy(cr, uid, move.id, defaults) move_obj.write(cr, uid, [move.id], { @@ -1442,7 +1442,7 @@ class stock_move(osv.osv): 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'), 'create_date': fields.datetime('Creation Date', readonly=True), 'date': fields.datetime('Date', required=True, help="Move date: scheduled date until move is done, then date of actual move processing", readonly=True), - 'date_expected': fields.datetime('Scheduled Date', required=True, help="Scheduled date for the processing of this move"), + 'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, help="Scheduled date for the processing of this move"), 'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}), 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True,states={'done': [('readonly', True)]}), @@ -1694,23 +1694,23 @@ class stock_move(osv.osv): """ moves = self.browse(cr, uid, ids) self.write(cr, uid, ids, {'state': 'confirmed'}) - i = 0 + res_obj = self.pool.get('res.company') + location_obj = self.pool.get('stock.location') + move_obj = self.pool.get('stock.move') + wf_service = netsvc.LocalService("workflow") def create_chained_picking(self, cr, uid, moves, context=None): new_moves = [] - res_obj = self.pool.get('res.company') - picking_obj = self.pool.get('stock.picking') - move_obj = self.pool.get('stock.move') if context is None: context = {} for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): - ptype = todo[0][1][5] and todo[0][1][5] or self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) + ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) pick_name = picking.name or '' if picking: pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context) else: pickid = False - for move, (loc, auto, delay, journal, company_id, ptype) in todo: + for move, (loc, dummy, delay, dummy, company_id, ptype) in todo: new_id = move_obj.copy(cr, uid, move.id, { 'location_id': move.location_dest_id.id, 'location_dest_id': loc.id, @@ -1728,7 +1728,6 @@ class stock_move(osv.osv): }) new_moves.append(self.browse(cr, uid, [new_id])[0]) if pickid: - wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr) if new_moves: create_chained_picking(self, cr, uid, new_moves, context) @@ -1888,9 +1887,7 @@ class stock_move(osv.osv): These reference values should possibly be converted before being posted in Journals to adapt to the primary and secondary currencies of the relevant accounts. """ - product_obj=self.pool.get('product.product') product_uom_obj = self.pool.get('product.uom') - price_type_obj = self.pool.get('product.price.type') # by default the reference currency is that of the move's company reference_currency_id = move.company_id.currency_id.id @@ -1957,12 +1954,8 @@ class stock_move(osv.osv): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ - track_flag = False partial_datas='' picking_ids = [] - product_uom_obj = self.pool.get('product.uom') - price_type_obj = self.pool.get('product.price.type') - product_obj = self.pool.get('product.product') partial_obj=self.pool.get('stock.partial.picking') partial_id=partial_obj.search(cr,uid,[]) if partial_id: @@ -1987,8 +1980,6 @@ class stock_move(osv.osv): if move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) - else: - pass if move.move_dest_id.auto_validate: self.action_done(cr, uid, [move.move_dest_id.id], context=context) @@ -2253,20 +2244,12 @@ class stock_move(osv.osv): like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom """ - import pdb - #pdb.set_trace() res = {} picking_obj = self.pool.get('stock.picking') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') uom_obj = self.pool.get('product.uom') - price_type_obj = self.pool.get('product.price.type') - sequence_obj = self.pool.get('ir.sequence') wf_service = netsvc.LocalService("workflow") - partner_id = partial_datas.get('partner_id', False) - address_id = partial_datas.get('address_id', False) - delivery_date = partial_datas.get('delivery_date', False) - new_moves = [] if context is None: context = {} @@ -2533,16 +2516,16 @@ class stock_picking_move_wizard(osv.osv_memory): def _get_picking(self, cr, uid, ctx=None): if ctx is None: ctx = {} - if ctx.get('action_id', False): - return ctx['action_id'] + if ctx.get('active_id', False): + return ctx['active_id'] return False def _get_picking_address(self, cr, uid, context=None): picking_obj = self.pool.get('stock.picking') if context is None: context = {} - if context.get('action_id', False): - picking = picking_obj.browse(cr, uid, [context['action_id']])[0] + if context.get('active_id', False): + picking = picking_obj.browse(cr, uid, [context['active_id']])[0] return picking.address_id and picking.address_id.id or False return False diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index 33d130c2d77..bce4de8b593 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -264,6 +264,7 @@ 2binvoiced +
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 2a4bec6fe3b..08a00b200b2 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -101,7 +101,7 @@ string="Split inventory lines" groups="base.group_extended" type="action" icon="terp-stock_effects-object-colorize" states="draft"/> - +
@@ -127,7 +127,7 @@ - + @@ -394,7 +394,7 @@ -