From bc0937dd75f93b0f37a33223e294641779e1f6cf Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 19 Jul 2010 01:13:57 +0530 Subject: [PATCH] [IMP] delivery: small improvement on rml [IMP] procurement: typo corrected [FIX] sale: error occured when people invoiced a line of a sale order then tried to invoice the whole sale order. Now it raises an error because they are supposed to finish the billing process of that SO by line [IMP] sale: small improvements in view [IMP] sale_crm: lots of improvments * made it use the onchange defined on sale.order.line * corrected view that displayed error client side because of unknown args passed in context + added the note tab * fix the sale.order.line creation in order to give also the price_unit and qty (and all other field of a sale.order.line, actually) * removed unecessary attributes on sale.order.make.line [IMP] sale_journal: created menu structure + removed widget selection not compatible with domain [FIX] sale_layout: corrected rml (total net, taxes, total taxes included were missing + 'your reference' as wrongly filled [IMP] sale_layout: removed the inheritance of tree view for lines and added a domain=[('layout_type','=','article')] on the menuitem sales \ billing \ lines to invoice [IMP] project: duplicating a task doesn't copy the active field, which is also replaced by a function fields with store=true bzr revid: qdp-launchpad@tinyerp.com-20100718194357-eqip22swh8as90n9 --- addons/delivery/report/shipping.rml | 2 +- addons/procurement/procurement.py | 2 +- addons/project/project.py | 12 +- addons/sale/sale.py | 14 +- addons/sale/sale_view.xml | 2 +- .../sale/wizard/sale_make_invoice_advance.xml | 2 +- addons/sale_crm/wizard/crm_make_sale.py | 171 ++++-------------- addons/sale_crm/wizard/crm_make_sale_view.xml | 25 ++- addons/sale_journal/sale_journal_view.xml | 10 +- .../sale_layout/report/report_sale_layout.rml | 93 +++++++++- addons/sale_layout/sale_layout_view.xml | 20 +- 11 files changed, 169 insertions(+), 184 deletions(-) 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)]}"/>