Hi again. I've verified that your invoice is OK, but the problem still persist in my installation. My version is the first stable 6.0 uploaded at www.openerp.com (now, the actual version at www.openerp.com is 6.0.2)
What version have you installed? Thanks -- You received this bug notification because you are a member of C2C OERPScenario, which is subscribed to the OpenERP Project Group. https://bugs.launchpad.net/bugs/741947 Title: [6.0] Error related with analytic accounts creating a sales invoice from picking that come from sales order with services Status in OpenERP Modules (addons): New Bug description: Environment: at stable 6.0 version, with installed modules "base", "stock", "sale", "purchase" and "analytic". Important: the modules "account_analytic_default" and "account_analytic_plans" must be not installed. If you try to create a sales invoice from picking that comes to a sales order that contains services and stockable products, the next error occurs: Field 'purchase_line_id' does not exist in object 'browse_record(sale.order.line, 5)' The origin of this error really is the "sale" module, when try to add the services lines into invoice, at method "action_invoice_create" from file "stock.py", in particular at method "_get_account_analytic_invoice". The problem is the fourth parameter "sale_line" passed to this funtion: account_analytic_id = self._get_account_analytic_invoice(cursor, user, picking, sale_line) .... because this parameter must be a "stock_move" object, and really is passed a "sale_order_line" object. But the solution involves: (1) the module "purchase", because also inherits the method "_get_account_analytic_invoice" from "stock_picking" class. And when execute this method, a "stock_move" object is expected, but a "sale_order_line object" is passed, and the error occurs. (2) the module "account_analytic_default", if has installed after. The reason are the same: inherits the method "_get_account_analytic_invoice" from "stock_picking" class. These are the corrections that I've applied to fix the bug: (1) At file "stock.py" from addon "sale", at function "def action_invoice_create": - account_analytic_id = self._get_account_analytic_invoice(cursor, user, picking, sale_line) + account_analytic_id = self._get_account_analytic_invoice(cursor, user, picking, None) 2) At file "stock.py" from addon "purchase", at function "def _get_account_analytic_invoice": - if move_line.purchase_line_id: + if move_line and move_line.purchase_line_id: 3) At file "account_analytic_default.py" from addon "account_analytic_default", at function "def _get_account_analytic_invoice": - rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) + product_id = False or move_line and move_line.product_id.id + rec = self.pool.get('account.analytic.default').account_get(cursor, user, product_id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) I hope it's useful for you. _______________________________________________ Mailing list: https://launchpad.net/~c2c-oerpscenario Post to : [email protected] Unsubscribe : https://launchpad.net/~c2c-oerpscenario More help : https://help.launchpad.net/ListHelp

