Fix billing project for new analytic account by invoice line

bzr revid: ced-ee09a5279bf17b8245d2ae627cf37330359105ee
This commit is contained in:
ced 2007-08-13 07:49:55 +00:00
parent d86b1f0c04
commit 3a866edc4a
2 changed files with 32 additions and 29 deletions

View File

@ -90,31 +90,36 @@ class project(osv.osv):
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist}}
_columns = {
'name': fields.char("Project name", size=128, required=True),
'active': fields.boolean('Active'),
'category_id': fields.many2one('account.analytic.account','Analytic Account'),
'priority': fields.integer('Priority'),
'manager': fields.many2one('res.users', 'Project manager'),
'warn_manager': fields.boolean('Warn manager'),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project members'),
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'parent_id': fields.many2one('project.project', 'Parent project'),
'child_id': fields.one2many('project.project', 'parent_id', 'Subproject'),
'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours'),
'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent'),
'date_start': fields.date('Project started on'),
'date_end': fields.date('Project should end on'),
'tariff': fields.float('Sales price'),
'mode': fields.selection([('project', 'By project'), ('hour', 'By hour'), ('effective', 'By effective hour')], 'Price setting mode'),
'partner_id': fields.many2one('res.partner', 'Customer'),
'contact_id': fields.many2one('res.partner.address', 'Contact'),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
'tax_ids': fields.many2many('account.tax', 'project_account_tax_rel', 'project_id','tax_id', 'Applicable taxes'),
'warn_customer': fields.boolean('Warn customer'),
'warn_header': fields.text('Mail header'),
'warn_footer': fields.text('Mail footer'),
'notes': fields.text('Notes'),
'timesheet_id': fields.many2one('hr.timesheet.group', 'Working hours'),
'name': fields.char("Project name", size=128, required=True),
'active': fields.boolean('Active'),
'category_id': fields.many2one('account.analytic.account','Analytic Account'),
'priority': fields.integer('Priority'),
'manager': fields.many2one('res.users', 'Project manager'),
'warn_manager': fields.boolean('Warn manager'),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project members'),
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'parent_id': fields.many2one('project.project', 'Parent project'),
'child_id': fields.one2many('project.project', 'parent_id', 'Subproject'),
'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours'),
'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent'),
'date_start': fields.date('Project started on'),
'date_end': fields.date('Project should end on'),
'tariff': fields.float('Sales price'),
'mode': fields.selection([
('', ''),
('project', 'By project'),
('hour', 'By hour'),
('effective', 'By effective hour')
], 'Price setting mode'),
'partner_id': fields.many2one('res.partner', 'Customer'),
'contact_id': fields.many2one('res.partner.address', 'Contact'),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
'tax_ids': fields.many2many('account.tax', 'project_account_tax_rel', 'project_id','tax_id', 'Applicable taxes'),
'warn_customer': fields.boolean('Warn customer'),
'warn_header': fields.text('Mail header'),
'warn_footer': fields.text('Mail footer'),
'notes': fields.text('Notes'),
'timesheet_id': fields.many2one('hr.timesheet.group', 'Working hours'),
'state': fields.selection([('open', 'Open'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', required=True),
}

View File

@ -110,8 +110,6 @@ def _do_orders(self, cr, uid, data, context):
'currency_id': task.project_id.pricelist_id.currency_id.id,
'payment_term': pay_term,
'journal_id': data['form']['journal_id'],
#'pricelist_id': task.project_id.pricelist_id.id,
'project_id': task.project_id.category_id.id
})
customers[task.project_id.id] = oid
else:
@ -130,8 +128,8 @@ def _do_orders(self, cr, uid, data, context):
'account_id': data['form']['sale_account_id'],
'price_unit': task.project_id.tariff,
'quantity': qty,
'invoice_line_tax_id': [(6,0, [t.id for t in task.project_id.tax_ids])]
'invoice_line_tax_id': [(6,0, [t.id for t in task.project_id.tax_ids])],
'account_analytic_id': task.project_id.category_id.id,
})
#pooler.get_pool(cr.dbname).get('project.task').write(cr, uid, [task.id], {'invoice_id':oid})
return {