Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

[8.0] Generating INVOICE from REPAIR ORDER - FLEET ID doesnt appear

Naroči se

Get notified when there's activity on this post

This question has been flagged
fleetinvoicemrp_repairodooV8
2 Odgovori
4934 Prikazi
Avatar
Mohammed Kamar-eddine

Using ODOO v8, Creating INVOICE from REPAIR ORDER - the vehicle (fleet_id) doesnt get transferred to the final INVOICE. What lines could i include to the .py file under 'action_nvoice_create' to allow the vehicule in the repair order to be transferred to the INVOICE

				
					
				


0
Avatar
Opusti
Mohammed Kamar-eddine
Avtor

Odoo Server Error

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 539, in _handle_exception

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 576, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 312, in _call_function

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 309, in checked_call

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 805, in __call__

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 405, in response_wrap

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\web\controllers\main.py", line 955, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 1113, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 881, in proxy_method

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 115, in dispatch_rpc

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 37, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 188, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 182, in exec_workflow_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 164, in execute_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 3571, in signal_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\__init__.py", line 85, in trg_validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\service.py", line 91, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\instance.py", line 80, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 120, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 248, in _split_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 257, in _join_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 95, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 116, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 162, in _execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 313, in wkf_expr_execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 291, in wkf_expr_eval_expr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\tools\safe_eval.py", line 314, in safe_eval

File "", line 1, in <module>

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 564, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 306, in wkf_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\mrp_repair.py", line 558, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 351, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\invoice.py", line 50, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mail\mail_thread.py", line 381, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 372, in old_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4093, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 508, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4231, in _create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 158, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 234, in execute

ValueError: "null value in column "fleet_id" violates not-null constraint

DETAIL: Failing row contains (2, null, null, 0.00, null, null, null, null, 1, 113, 2016-06-25 14:54:53.655, 1, null, null, null, 296, null, none, 2, null, draft, null, out_invoice, null, 1179, f, null, null, null, null, 2016-06-25 14:54:53.655, 1, 1, OR-003, null, OR-003, f, null, null, 1, null, null, null).

" while evaluating

u'wkf_invoice_create()'

Avatar
Mohammed Kamar-eddine
Avtor Best Answer

def action_invoice_create(self, cr, uid, ids, group=False, context=None):
    context = dict(context or {})
    repair = self.browse(cr, uid, ids[0], context)
    context['default_fleet_id'] = repair.fleet_id and repair.fleet_id.id or False
    res = super(mrp_repair, self).action_invoice_create(
        cr, uid, ids, group=group, context=context)

I've added the code listed above, which resulted in this code below:


def action_invoice_create(self, cr, uid, ids, group=False, context=None):
    print "action_invoice_create---------------",ids, group, context
    context = dict(context or {})
    repair = self.browse(cr, uid, ids[0], context)
    context['fleet_id'] = repair.fleet_id and repair.fleet_id.id or False
    res = super(mrp_repair, self).action_invoice_create(cr, uid, ids,
                                                        group=group,
                                                        context=context)
    inv_line_obj = self.pool.get('account.invoice.line')
    inv_obj = self.pool.get('account.invoice')
    for repair_id, invoice_id in res.iteritems():
        if not invoice_id:
            continue
        invoice  = inv_obj.browse(cr, uid, invoice_id) #activated by MSKE-25/06/2016
        inv_obj.write(cr, uid, [invoice_id],{'fleet_id': fleet_id}) # added by MSKE-25/06/2016
        for rsol in repair.order_line_ids:
            name = rsol.name or ''

            if rsol.product_id.property_account_income:
                account_id = rsol.product_id.property_account_income.id
            elif rsol.product_id.categ_id.property_account_income_categ:
                account_id = rsol.product_id.categ_id.property_account_income_categ.id
            else:
                raise osv.except_osv(_('Error!'), _('No account defined for product "%s".') % rsol.product_id.name)
            invoice_line_vals = {
                'invoice_id': invoice_id,
                'name': rsol.product_id.name,
                'origin': rsol.repair_sale_order_line_id.name,
                'account_id': account_id,
                #'quantity': rsol.product_uom_qty,
                'invoice_line_tax_id': [(6, 0, [x.id for x in rsol.tax_id])],
                'uos_id': rsol.product_id.uom_id.id,
                'price_unit': rsol.price_unit,
                'price_subtotal': rsol.product_uom_qty * rsol.price_unit,
                'product_id': rsol.product_id and rsol.product_id.id or False
            }

            print "invoice_line_vals----------",invoice_line_vals

            invoice_line_id = inv_line_obj.create(cr, uid, invoice_line_vals)
            print "after line create----------------------------",invoice_line_id
        self.pool.get('account.invoice').\
            button_reset_taxes(cr, uid, invoice_id, context=context)
    return res

But i'm receiving the error:

ValueError: "null value in column "fleet_id" violates not-null constraint

Any advice? Where did i go wrong

0
Avatar
Opusti
Mohammed Kamar-eddine
Avtor

THE ERROR im receiving now:

Odoo Server Error

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 539, in _handle_exception

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 576, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 312, in _call_function

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 309, in checked_call

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 805, in __call__

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 405, in response_wrap

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\web\controllers\main.py", line 955, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 1113, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 881, in proxy_method

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 115, in dispatch_rpc

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 37, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 188, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 182, in exec_workflow_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 164, in execute_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 3571, in signal_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\__init__.py", line 85, in trg_validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\service.py", line 91, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\instance.py", line 80, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 120, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 248, in _split_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 257, in _join_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 95, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 116, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 162, in _execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 313, in wkf_expr_execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 291, in wkf_expr_eval_expr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\tools\safe_eval.py", line 314, in safe_eval

File "", line 1, in <module>

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 564, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 306, in wkf_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\mrp_repair.py", line 558, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 351, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\invoice.py", line 50, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mail\mail_thread.py", line 381, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 372, in old_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4093, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 508, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4231, in _create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 158, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 234, in execute

ValueError: "null value in column "fleet_id" violates not-null constraint

DETAIL: Failing row contains (2, null, null, 0.00, null, null, null, null, 1, 113, 2016-06-25 14:54:53.655, 1, null, null, null, 296, null, none, 2, null, draft, null, out_invoice, null, 1179, f, null, null, null, null, 2016-06-25 14:54:53.655, 1, 1, OR-003, null, OR-003, f, null, null, 1, null, null, null).

" while evaluating

u'wkf_invoice_create()'

Avatar
ayman mohammed adam
Best Answer

Dear all,

you must add 

fleet_id field  many2one on account.invoice Model and then update this field on created invoice  



def action_invoice_create(self, cr, uid, ids, group=False, context=None):
        print "action_invoice_create---------------",ids, group, context
        repair = self.browse(cr, uid, ids[0])
        res = super(mrp_repair, self).action_invoice_create(cr, uid, ids,
                                                            group=group,
                                                            context=context)
        inv_line_obj = self.pool.get('account.invoice.line')
        inv_obj = self.pool.get('account.invoice')
        for repair_id, invoice_id in res.iteritems():
            if not invoice_id:
                continue

                        invoice = inv_obj.browse(cr, uid, invoice_id)
                        inv_obj.write(cr, uid, [invoice_id],{'fleet_id':your fleet _id})
0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Generate invoice automatic when confirm sale in sales order
invoice odooV8
Avatar
Avatar
1
nov. 16
8447
Invoice duplicate function
invoice duplication odooV8
Avatar
Avatar
1
dec. 22
6476
Advance on sale without created invoice
invoice advance odooV8
Avatar
Avatar
2
jun. 20
4609
Translation not working for invoice report
invoice report odooV8
Avatar
Avatar
Avatar
5
jan. 20
9084
Invoice number - validating an invoice will not re-use the internal_number if exists Solved
invoice invoice_number odooV8
Avatar
1
nov. 17
4599
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now