Skip to Content
Menu
This question has been flagged

Just have written an importer for OpenProject Ticket System to Odoo 10.0.

Everything works just perfect and automatic. Except one issue, where we just found a workaround, but no real solution yet.

Therefor i'll describe what we do and the workaround:

Maybe i am just missing something obvious someone may give the hint for me.

Excerpt of what the code does:

 # create sale.order for each imported project    .....
            odoo_id = ProjectProject.create(project_project)    .....
        saleorder = {                    'state': 'draft',                    'date_order': mk_date(row['created_on']),                    'user_id': 1,                    'currency_id': 1,                    'client_order_ref': 'Ticketsystem',                    'partner_id': partner_id[0],                    'partner_invoice_id': partner_id[0],                    'partner_shipping_id': partner_id[0],                    'project_id': pid[0]['analytic_account_id'][0], # Kostenstelle                    'project_project_id': odoo_id, # Projekt                    'picking_policy': 'direct',                    'pricelist_id': 1,                    'note': 'created from openproject import',                    'origin': project_project['openproject_id'],                    'warehouse_id': 1,                    'order_line': [                        (0, 0, {                            'product_uom_qty': 1,                            'product_uom': 5,                            'product_id': general_service_product, # this is product.product of type service, order_policy "timesheet"                        }),                    ],                }        SaleOrder = odoo.get_model('sale.order')        so_id = SaleOrder.search([('origin', '=', project_project['openproject_id'])])        if len(so_id) == 0:
            SaleOrder.create(saleorder)    .....
        # create account.analytic.line    .....
        accaline = {            'openproject_id': row['id'], # used to be able to update/add timesheet entries from openproject            'account_id': none2false(lookup_project_aa(lookup_project(row['project_id']))), # Analysekonto / many2one            'amount': row['hours'] * o.gethourprice(row['id']), # Betrag / monetary            'company_id': 1, # Unternehmen / many2one            'date': mk_date(row['spent_on']), # Datum / date            'name': cleantext(row['comments']), # Beschreibung / char            'product_id': general_service_product, # Produkt / many2one            'project_id': lookup_project(row['project_id']), # Projekt / many2one            'task_id': lookup_task('work_package_id'), # Aufgabe / many2one            'unit_amount': row['hours'], # Anzahl / float            'user_id': lookup_user(row['user_id']), # Benutzer / many2one            }        AccountAnalyticLine = odoo.get_model('account.analytic.line') # this is my xml-rpc factory        odoo_id = AccountAnalyticLine.search([('openproject_id', '=', accaline['openproject_id'])])        if not odoo_id:
            odoo_id = AccountAnalyticLine.create(accaline)    .....


After doing such import, Account analytic lines are all there.

But in Sales/Sales to invoice there is nothing to be invoiced.

Expected Result:

 

- all imported analytic entries should be on "sales to invoice"

Observed Result:

 

No imported entries appear to be invoiced

Workaround:

1. go into Accounting/Advisor/Analytic entries and select & export all, just one unimportant field like "ref".

2. re-import file from 1.

After this, all analytic entries are found to be billable under "Sales to invoice". Although there is no observable result in analytic entries.

Question:

What can be done programmatically to make those analytic entries invoiceable directly with import, without described workaround?

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 24
528
1
May 23
1814
1
Mar 21
2061
0
Dec 24
32
1
Dec 24
58