diff --git a/addons/delivery/report/shipping.rml b/addons/delivery/report/shipping.rml index 79a44933935..5089d261fe3 100644 --- a/addons/delivery/report/shipping.rml +++ b/addons/delivery/report/shipping.rml @@ -114,7 +114,7 @@ - Invoiced to + [[ o.sale_id and o.sale_id.partner_invoice_id and 'Invoiced to' or '' ]] [[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.partner_id.name or '']] [[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.name or '']] [[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.street or '']] diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index e7a5f1c195a..840c5f74d67 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -319,7 +319,7 @@ class procurement_order(osv.osv): move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids): if procurement.product_qty <= 0.00: - raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity of Procurement Order(s), it should not be less than 1!')) + raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity in Procurement Order(s), it should not be less than 1!')) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: source = procurement.location_id.id diff --git a/addons/project/project.py b/addons/project/project.py index af8332abb27..816e85c29b4 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -337,6 +337,7 @@ class task(osv.osv): def copy_data(self, cr, uid, id, default={}, context=None): default = default or {} default['work_ids'] = [] + default['active'] = True return super(task, self).copy_data(cr, uid, id, default, context) def _check_dates(self, cr, uid, ids, context=None): @@ -353,8 +354,17 @@ class task(osv.osv): return False return True + def _is_template(self, cr, uid, ids, field_name, arg, context=None): + res = {} + for task in self.browse(cr, uid, ids, context=context): + res[task.id] = True + if task.project_id: + if task.project_id.active == False or task.project_id.state == 'template': + res[task.id] = False + return res + _columns = { - 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the task without removing it. This is basically used for the management of templates of projects and tasks."), + 'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."), 'name': fields.char('Task Summary', size=128, required=True), 'description': fields.text('Description'), 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Importance'), diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 7191f3dbac8..155f157ae50 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -473,7 +473,9 @@ class sale_order(osv.osv): for o in self.browse(cr, uid, ids): lines = [] for line in o.order_line: - if (line.state in states) and not line.invoiced: + if line.invoiced: + raise osv.except_osv(_('Error !'), _('The Sale Order already has some lines invoiced. You should continue the billing process by line.')) + elif (line.state in states): lines.append(line.id) created_lines = self.pool.get('sale.order.line').invoice_line_create(cr, uid, lines) if created_lines: @@ -830,11 +832,11 @@ class sale_order_line(osv.osv): 'notes': fields.text('Notes'), 'th_weight': fields.float('Weight', readonly=True, states={'draft':[('readonly',False)]}), 'state': fields.selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('done', 'Done'),('cancel', 'Cancelled'),('exception', 'Exception')], 'State', required=True, readonly=True, - help='* The \'Draft\' state is set automatically when sale order in draft state. \ - \n* The \'Confirmed\' state is set automatically when sale order in confirm state. \ - \n* The \'Exception\' state is set automatically when sale order is set as exception. \ - \n* The \'Done\' state is set automatically when sale order is set as done. \ - \n* The \'Cancelled\' state is set automatically when user cancel sale order.'), + help='* The \'Draft\' state is set when the related sale order in draft state. \ + \n* The \'Confirmed\' state is set when the related sale order is confirmed. \ + \n* The \'Exception\' state is set when the related sale order is set as exception. \ + \n* The \'Done\' state is set when the sale order line has been picked. \ + \n* The \'Cancelled\' state is set when a user cancel the sale order related.'), 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'), 'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', string='Salesman'), 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}), diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 2f793b93bf2..008fc6be35e 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -404,7 +404,7 @@ string="Create Invoice" type="object" icon="terp-document-new" - attrs="{'invisible': ['|',('state', '!=', 'confirmed'),('invoiced', '=', 1)]}"/> + attrs="{'invisible': ['|',('state', 'in', ('draft','cancel')),('invoiced', '=', 1)]}"/>