From bc23a9eed7b97885e47611294ef56aed819a4e80 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Fri, 1 Feb 2013 18:54:54 +0530 Subject: [PATCH 01/77] [IMP]product: Set All for product category instead of All Products bzr revid: dbr@tinyerp.com-20130201132454-grkjkqexahqcabz1 --- addons/product/product_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml index 49362e380f4..91d78722d14 100644 --- a/addons/product/product_data.xml +++ b/addons/product/product_data.xml @@ -5,7 +5,7 @@ Resource: product.uom.categ --> - All products + All From 9b31288c14613f62bd339dd29050e570100c088e Mon Sep 17 00:00:00 2001 From: "Ravish (Open ERP)" Date: Mon, 4 Mar 2013 16:25:32 +0530 Subject: [PATCH 02/77] currecy_so_po bzr revid: rmu@tinyerp.com-20130304105532-hzwakhr1y71q88iz --- addons/product/security/product_security.xml | 2 ++ addons/purchase/purchase.py | 3 ++- addons/purchase/purchase_view.xml | 2 +- addons/sale/sale.py | 5 +++-- addons/sale/sale_view.xml | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 2e6bdac9fca..bf528160464 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -10,11 +10,13 @@ Sales Pricelists + Purchase Pricelists + diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e76bf4a0358..4a37e28b96f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -184,7 +184,7 @@ class purchase_order(osv.osv): 'warehouse_id': fields.many2one('stock.warehouse', 'Destination Warehouse'), 'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')], states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]} ), 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."), - 'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", string="Currency",readonly=True, required=True), + 'currency_id': fields.many2one('res.currency','Currency', readonly=True, required=True,states={'draft': [('readonly', False)],'sent': [('readonly', False)]}), 'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The status of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' status. Then the order has to be confirmed by the user, the status switch to 'Confirmed'. Then the supplier must confirm the order to change the status to 'Approved'. When the purchase order is paid and received, the status becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the status becomes in exception.", select=True), 'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}), 'validator' : fields.many2one('res.users', 'Validated by', readonly=True), @@ -224,6 +224,7 @@ class purchase_order(osv.osv): 'create_uid': fields.many2one('res.users', 'Responsible'), 'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal'), + 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id } _defaults = { 'date_order': fields.date.context_today, diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 8ba730567e2..a365b719f6a 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -191,7 +191,7 @@ - + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 8656dccd5db..0e4e1333e53 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -215,7 +215,7 @@ class sale_order(osv.osv): help="""This field controls how invoice and delivery operations are synchronized. - With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Pricelist for current sales order."), - 'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", string="Currency", readonly=True, required=True), + 'currency_id': fields.many2one('res.currency','Currency', readonly=True, required=True,states={'draft': [('readonly', False)],'sent': [('readonly', False)]}), 'project_id': fields.many2one('account.analytic.account', 'Contract / Analytic', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="The analytic account related to a sales order."), 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), @@ -261,7 +261,8 @@ class sale_order(osv.osv): 'shop_id': _get_default_shop, '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 + 'note': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.sale_note, + 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id } _sql_constraints = [ ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'), diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index f4b8283f9b4..115f5dad79c 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -163,7 +163,7 @@ - + From cca957c7169f5a72f25a3e7f0ed9d397091bb5f1 Mon Sep 17 00:00:00 2001 From: "Ravish (Open ERP)" Date: Mon, 4 Mar 2013 16:52:06 +0530 Subject: [PATCH 03/77] currecy_so_po_improve bzr revid: rmu@tinyerp.com-20130304112206-dk1486i17igx33g0 --- addons/purchase/purchase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 4a37e28b96f..4c534265763 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -224,7 +224,7 @@ class purchase_order(osv.osv): 'create_uid': fields.many2one('res.users', 'Responsible'), 'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal'), - 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id + } _defaults = { 'date_order': fields.date.context_today, @@ -236,6 +236,7 @@ class purchase_order(osv.osv): 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id, 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), 'journal_id': _get_journal, + 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id } _sql_constraints = [ ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'), From 1ee33ffb205e7ee2adc42ffa42eac7a50e6f7ad9 Mon Sep 17 00:00:00 2001 From: "Ravish (Open ERP)" Date: Tue, 5 Mar 2013 10:14:47 +0530 Subject: [PATCH 04/77] changes as per suggestion bzr revid: rmu@tinyerp.com-20130305044447-iuyiw2o8epioaajt --- addons/product/security/product_security.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index bf528160464..2e6bdac9fca 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -10,13 +10,11 @@ Sales Pricelists - Purchase Pricelists - From 307818ea0b0ee424cce1405de79b010c73015660 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 20 Mar 2013 12:15:20 +0100 Subject: [PATCH 05/77] [ADD] additions from trunk-hr-goal-mat bzr revid: mat@openerp.com-20130320111520-fmz14if4k400s9s4 --- addons/hr/__openerp__.py | 1 + addons/hr/hr.py | 41 ++++++++++++++++++++++++++++++++ addons/hr/hr_view.xml | 16 +++++++++---- addons/hr/mail_hr_view.xml | 24 +++++++++++++++++++ addons/hr/static/src/css/hr.css | 5 ++++ addons/mail/mail_thread_view.xml | 3 ++- 6 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 addons/hr/mail_hr_view.xml diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index b4b8e982845..b978a83e658 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -59,6 +59,7 @@ You can manage: 'hr_installer.xml', 'hr_data.xml', 'res_config_view.xml', + 'mail_hr_view.xml', ], 'demo': ['hr_demo.xml'], 'test': [ diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 467f34f708b..590e8a52fa8 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -23,6 +23,8 @@ from openerp import addons import logging from openerp.osv import fields, osv from openerp import tools +from openerp.tools.translate import _ + _logger = logging.getLogger(__name__) class hr_employee_category(osv.osv): @@ -264,6 +266,45 @@ class hr_employee(osv.osv): image_path = addons.get_module_resource('hr', 'static/src/img', 'default_image.png') return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64')) + def action_follow(self, cr, uid, ids, context=None): + """ Wrapper because message_subscribe_users take a user_ids=None + that receive the context without the wrapper. """ + return self.message_subscribe_users(cr, uid, ids, context=context) + + def action_unfollow(self, cr, uid, ids, context=None): + """ Wrapper because message_unsubscribe_users take a user_ids=None + that receive the context without the wrapper. """ + return self.message_unsubscribe_users(cr, uid, ids, context=context) + + def message_post(self, cr, uid, thread_id, context=None, **kwargs): + """Overwrite the message_post method when using the send to my + followers screen + + When a message is sent to a hr.employee using the action + action_mail_inbox_feeds, the context is extended with res_users_id + containing the user id of the user linked to the employee and + default_res_id contains 0 (to avoid misused of the function called from + the inbox page). + In these conditions, the thread_id used to send the message is the id + of the employee instead of the res_users (or partner_id). + If several employee are linked to the same user_id, the message is + duplicated and sent to every user. + + :return: the result of message_post from mail_thread, last call if + several messages are sent. + """ + if 'res_users_id' in context: # and context['default_res_id'] == 0: + employee_ids = self.search(cr, uid, [('user_id', '=', context['res_users_id'])], context=context) + if len(employee_ids) > 0: + for employee_id in employee_ids: + res = super(hr_employee, self).message_post(cr, uid, employee_id, context=context, **kwargs) + return res + else: + raise osv.except_osv(_('Warning!'), _('Your user is not linked to an employee form, which is required to send messages to your followers.')) + + # if no overwrite, send message as usual + return super(hr_employee, self).message_post(cr, uid, thread_id, context=context, **kwargs) + _defaults = { 'active': 1, 'image': _get_default_image, diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index e0c3edfdb39..9d08627b3b2 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -27,6 +27,10 @@