diff --git a/addons/account_report/account_view.xml b/addons/account_report/account_view.xml index f607f195d00..dba6d5d24c7 100644 --- a/addons/account_report/account_view.xml +++ b/addons/account_report/account_view.xml @@ -17,8 +17,8 @@ - - + diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 1ca37a426a2..6805131155a 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -96,7 +96,7 @@ this if you want the rule to send an email to the partner."), res_count = True if action.trg_max_history: res_count = False - if len(obj.message_ids) >= action.trg_max_history: + if len(obj.message_ids) <= action.trg_max_history: res_count = True ok = ok and res_count return ok diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index fdef01e2ef2..0955174b209 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -144,6 +144,7 @@ + @@ -156,6 +157,7 @@ + @@ -168,6 +170,7 @@ + @@ -183,6 +186,7 @@ + @@ -207,6 +211,7 @@ + @@ -219,6 +224,7 @@ + @@ -231,6 +237,7 @@ + @@ -243,6 +250,7 @@ + @@ -255,6 +263,7 @@ + @@ -267,6 +276,7 @@ + diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index 76897d46e58..c9fd50986f7 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -32,10 +32,16 @@ class stock_picking(osv.osv): res = {} uom_obj = self.pool.get('product.uom') for picking in self.browse(cr, uid, ids, context): - total_weight = 0.00 + total_weight = total_weight_net = 0.00 + for move in picking.move_lines: total_weight += move.weight - res[picking.id] = total_weight + total_weight_net += move.weight_net + + res[picking.id] = { + 'weight': total_weight, + 'weight_net': total_weight_net, + } return res @@ -48,7 +54,12 @@ class stock_picking(osv.osv): _columns = { 'carrier_id':fields.many2one("delivery.carrier","Carrier"), 'volume': fields.float('Volume'), - 'weight': fields.function(_cal_weight, method=True, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), + 'weight': fields.function(_cal_weight, method=True, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight', + store={ + 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), + 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20), + }), + 'weight_net': fields.function(_cal_weight, method=True, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight', store={ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20), @@ -128,22 +139,34 @@ class stock_move(osv.osv): res = {} uom_obj = self.pool.get('product.uom') for move in self.browse(cr, uid, ids, context): - weight = 0.00 + weight = weight_net = 0.00 if move.product_id.weight > 0.00: converted_qty = move.product_qty - + if move.product_uom.id <> move.product_id.uom_id.id: converted_qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, move.product_id.uom_id.id) weight = (converted_qty * move.product_id.weight) - res[move.id] = weight + + if move.product_id.weight_net > 0.00: + weight_net = (converted_qty * move.product_id.weight_net) + + res[move.id] = { + 'weight': weight, + 'weight_net': weight_net, + } return res - + _columns = { - 'weight': fields.function(_cal_move_weight, method=True, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), + 'weight': fields.function(_cal_move_weight, method=True, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight', store={ 'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_id', 'product_qty', 'product_uom'], 20), }), + 'weight_net': fields.function(_cal_move_weight, method=True, type='float', string='Net weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight', + store={ + 'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_id', 'product_qty', 'product_uom'], 20), + }), + } stock_move() diff --git a/addons/hr_recruitment/report/hr_recruitment_report.py b/addons/hr_recruitment/report/hr_recruitment_report.py index 7bce80d538d..524a2265e23 100644 --- a/addons/hr_recruitment/report/hr_recruitment_report.py +++ b/addons/hr_recruitment/report/hr_recruitment_report.py @@ -46,30 +46,7 @@ class hr_recruitment_report(osv.osv): res = {} state_perc = 0.0 avg_ans = 0.0 - - for case in self.browse(cr, uid, ids, context): - if field_name != 'avg_answers': - state = field_name[5:] - cr.execute("select count(*) from crm_lead where \ - section_id =%s and state='%s'"%(case.section_id.id, state)) - state_cases = cr.fetchone()[0] - perc_state = (state_cases / float(case.nbr)) * 100 - - res[case.id] = perc_state - else: - model_name = self._name.split('report.') - if len(model_name) < 2: - res[case.id] = 0.0 - else: - model_name = model_name[1] - - cr.execute("select count(*) from crm_case_log l, ir_model m \ - where l.model_id=m.id and m.model = '%s'" , model_name) - logs = cr.fetchone()[0] - - avg_ans = logs / case.nbr - res[case.id] = avg_ans - + #TODO: Calculate avg_answer, perc_done, perc_cancel return res _columns = { @@ -88,15 +65,11 @@ class hr_recruitment_report(osv.osv): 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'year': fields.char('Year', size=4, readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), - ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), - 'day': fields.char('Day', size=128, readonly=True), 'date': fields.date('Date', readonly=True), 'date_closed': fields.date('Closed', readonly=True), 'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True), 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'), - 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"), + 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('object_id.model', '=', 'hr.applicant')]"), 'department_id':fields.many2one('hr.department','Department',readonly=True), 'priority': fields.selection(hr_recruitment.AVAILABLE_PRIORITIES, 'Appreciation'), 'salary_prop' : fields.float("Salary Proposed"), diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index cdc5dd6b5ac..f8630065598 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -88,10 +88,11 @@ 'board_manufacturing_demo.xml' ], 'test': [ + 'test/mrp_procurement.yml', 'test/mrp_packs.yml', 'test/mrp_phantom_bom.yml', 'test/mrp_production_order.yml', - 'test/mrp_procurement.yml' + ], 'installable': True, 'active': False, diff --git a/addons/mrp/company_view.xml b/addons/mrp/company_view.xml index e94324f8195..f5f06518565 100644 --- a/addons/mrp/company_view.xml +++ b/addons/mrp/company_view.xml @@ -6,6 +6,7 @@ res.company.mrp.config res.company form + 22 diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index fd9f8335987..fad20da2589 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -459,9 +459,9 @@ class mrp_production(osv.osv): help="This is the internal picking list that brings the finished product to the production plan"), 'move_prod_id': fields.many2one('stock.move', 'Move product', readonly=True), 'move_lines': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), - 'move_lines2': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))], readonly=True), + 'move_lines2': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))]), 'move_created_ids': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), - 'move_created_ids2': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))], readonly=True), + 'move_created_ids2': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))]), 'product_lines': fields.one2many('mrp.production.product.line', 'production_id', 'Scheduled goods'), 'workcenter_lines': fields.one2many('mrp.production.workcenter.line', 'production_id', 'Work Centers Utilisation'), 'state': fields.selection([('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Cancelled'),('done','Done')],'State', readonly=True, diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml index fa54dc0096f..f454a8d14a8 100644 --- a/addons/mrp/mrp_demo.xml +++ b/addons/mrp/mrp_demo.xml @@ -713,6 +713,9 @@ 12.0 + + + diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 5d47c8acf0c..b84ba1aca95 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -611,11 +611,11 @@ - - - - - + + + + +