Hi
please tell me how to fix this error:
Server Traceback (most recent call last):
File "/home/erp_user/openerp/production/server/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/home/erp_user/openerp/production/server/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/home/erp_user/openerp/production/server/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/home/erp_user/openerp/production/server/openerp/osv/osv.py", line 188, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/erp_user/openerp/production/server/openerp/osv/osv.py", line 131, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/erp_user/openerp/production/server/openerp/osv/osv.py", line 197, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/erp_user/openerp/production/server/openerp/osv/osv.py", line 185, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/erp_user/openerp/production/server/openerp/addons/base/module/module.py", line 495, in button_immediate_uninstall
return self._button_immediate_function(cr, uid, ids, self.button_uninstall, context=context)
File "/home/erp_user/openerp/production/server/openerp/addons/base/module/module.py", line 475, in _button_immediate_function
_, pool = pooler.restart_pool(cr.dbname, update_module=True)
File "/home/erp_user/openerp/production/server/openerp/pooler.py", line 39, in restart_pool
registry = RegistryManager.new(db_name, force_demo, status, update_module)
File "/home/erp_user/openerp/production/server/openerp/modules/registry.py", line 218, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/home/erp_user/openerp/production/server/openerp/modules/loading.py", line 413, in load_modules
pool.get('ir.module.module').module_uninstall(cr, SUPERUSER_ID, mod_ids_to_remove)
File "/home/erp_user/openerp/production/server/openerp/addons/base/module/module.py", line 439, in module_uninstall
ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
File "/home/erp_user/openerp/production/server/openerp/addons/base/ir/ir_model.py", line 532, in _module_data_uninstall
WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table))
AttributeError: 'NoneType' object has no attribute '_table'
↧
AttributeError: 'NoneType' object has no attribute '_table'
↧
Can selection fields save floats to the DB or just integers and strings?
Hello, I am creating a module with a selection field. I would like a float number to be saved to the DB when a user selects a choice from the selection drop down, but when I make a selection then I get an error like this:
DataError: invalid input syntax for integer: "0.25"
So my question is, can floating numbers be used as values for a selection field, or can you use only integers or strings? Thank you
↧
↧
Error when printing an Invoice
Hello, Im getting an error when Im trying to print an invoice that says this:

This error occurs when you go to Accounting -> Customer Invoices -> and then click the Print -> Invoices button on the top of the page
↧
Login error after moving site
I have moved a site from one VPS to another (for speed improvements).
If I create a new database, it works apart from a minor error about the language.
If I load my existing database, when I login with the correct user details I get the following errors and it returns "Invalid username or password"
I am struggling to find any direction to try to fix this.
I have ensured all custom modules are copied over.
----------
OpenERP Server Error Client Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/http.py", line 195, in dispatch response["result"] = method(self, **self.params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/controllers/main.py", line 817, in authenticate req.session.authenticate(db, login, password, env) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 116, in authenticate if uid: self.get_context() File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 166, in get_context self.context = self.model('res.users').context_get() or {} File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 40, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 28, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 101, in send raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info) Server Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/web/session.py", line 87, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/netsvc.py", line 281, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/service/web_services.py", line 614, in dispatch res = fn(db, uid, *params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/osv/osv.py", line 169, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/osv/osv.py", line 123, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/osv/osv.py", line 179, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/osv/osv.py", line 166, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/tools/cache.py", line 18, in lookup r = self.lookup(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/tools/cache.py", line 46, in lookup value = d[key] = self.method(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/addons/base/res/res_users.py", line 348, in context_get res = getattr(user,k) or False File "/usr/lib/python2.6/site-packages/openerp-7.0_20121227_075624-py2.6.egg/openerp/osv/orm.py", line 486, in __getattr__ raise AttributeError(e) AttributeError: 3`
↧
Why can't I re-import this import compatible csv of BOMs?
I exported a csv of BOMs using only blue fields and then I get an error re-importing the unmodified file.
* I created a database with the demo data. I installed the MRP app. I allowed importing of csv.
* I went to Manufacturing > Bill of Materials, and selected all the BOMs.
* I Clicked on the More menu and then Export.
* I chose "Import compatible", "csv".
* I went through the entire list of variables, including sub-menus (ex BOM lines), and "added" all blue variables.
* I exported and saved the csv file.
* I closed the export window.
* I clicked on Import.
* I selected the csv file I just saved.
* I clicked on Validate
* I got the following errors:
No matching record found for name 'Bill of Materia...' in field 'Messages' at row 2
Value '15" LCD Monitor ,Computer Case-1,RAM DDR 512MB,Mouse, Laser,USB Keyboard, QWERTY' not found in selection field 'BoM Lines' at row 2
Value '17" LCD Monitor,Computer Case-2,Mouse, Laser,USB Keyboard, QWERTY,RAM DDR 512MB' not found in selection field 'BoM Lines' at row 3
Value '15" LCD Monitor ,Computer Case-1,Mouse, Laser,USB Keyboard, QWERTY,RAM DDR2 1GB' not found in selection field 'BoM Lines' at row 4
Value 'Windows 7 Professional,USB Keyboard, QWERTY,Mouse, Wireless' not found in selection field 'BoM Lines' at row 5
Here are the possible values:
Value 'HDD 500GB' not found in selection field 'BoM Lines' at row 6
Value '320GB HDD' not found in selection field 'BoM Lines' at row 7
Value 'Processesor AMD 8-Core,Motherboard I9P57,HDD 320GB' not found in selection field 'BoM Lines' at row 8
Value 'Processor Core i5 2.70 Ghz,Motherboard A20Z7,HDD 500GB,Graphics Card' not found in selection field 'BoM Lines' at row 9
Value 'Windows 7 Professional,USB Keyboard, AZERTY,Mouse, Laser' not found in selection field 'BoM Lines' at row 11


↧
↧
ValueError: No such external ID currently defined in the system: __export__.product_product
Hi I have been trying from past two days to import products from csv file to new database in openerp and whenever i try I get this error : ValueError: No such external ID currently defined in the system: __export__.product_product. I tried importing with compatible fields only and then added all the required fields, then i exported almost a dozen of product.product csv file successfully but on importing it gives the above mentioned error. Please help anyone asap. Really urgent.> External ID Active Can be Rent Can be> Sold Category Category/ID Category/Name Company/ID Cost> Price Costing Method Default Unit Of> Measure Default Unit Of> Measure/Name Inventory> Valuation Measure Type Name Name Net> weight Procurement Method Product> Type Product Template/Category Product> Template/Category/Name Product> Template/Cost Price Product> Template/Costing Method Product> Template/Default Unit Of> Measure Product Template/Default Unit> Of Measure/Name Product> Template/Default Unit Of Measure/UoM> Type Product Template/ID Product> Template/Measure Type Product> Template/Name Product> Template/Procurement Method Product> Template/Product Type Product> Template/Supply method Public> Price Purchase Unit of> Measure Quantity Available Quantity On> Hand Reference Sale> Price Status Supply method Track> Incoming Lots Track Manufacturing> Lots Track Outgoing Lots UOM -> UOS> Coeff Variant Price Extra Variant> Price Margin Variants Warranty> (months) product_tmpl_id/id> product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-3gAfy02Z8ozx TRUE FALSE TRUE __export__.product_category_456 456 Adhesive 1 1 Standard> Price product.product_uom_kgm kg Real> Time (automated) fixed Tile Fixer> (Bag) Faros Tile Fixer (Bag)> Faros Make to> Stock Consumable __export__.product_category_456 Adhesive 1 Standard> Price product.product_uom_kgm kg reference 2414 fixed Tile> Fixer (Bag) Faros Make to> Stock Consumable Buy 285 product.product_uom_kgm 992 993 Adhesive 285 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-L7JnbHDTHG7w TRUE FALSE TRUE __export__.product_category_456 456 Adhesive 1 1 Standard> Price product.product_uom_kgm kg Real> Time (automated) fixed Tile Grout Tile> Grout Make to> Stock Consumable __export__.product_category_456 Adhesive 1 Standard> Price product.product_uom_kgm kg reference 2410 fixed Tile> Grout Make to> Stock Consumable Buy 50 product.product_uom_kgm 996 997 Adhesive 50 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-GpgPnbs6Hrbq TRUE FALSE TRUE __export__.product_category_632 632 1.800> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 1.800> Kg Araldite 1.800 Kg Make to> Stock Consumable __export__.product_category_632 1.800> Kg 1 Standard> Price product.product_uom_unit PCE reference 976 fixed Araldite 1.800 Kg Make to Stock Consumable Buy 935 product.product_uom_unit 998 999 Adhesive> / Araldite / 1.800> Kg 935 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-f1qsZMi1l1YF TRUE FALSE TRUE __export__.product_category_638 638 13 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 13> Gm Araldite 13 Gm Make to> Stock Consumable __export__.product_category_638 13> Gm 1 Standard> Price product.product_uom_unit PCE reference 982 fixed Araldite 13 Gm Make to> Stock Consumable Buy 32 product.product_uom_unit 995 1000 Adhesive> / Araldite / 13> Gm 32 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-Xonkk2ryllgU TRUE FALSE TRUE __export__.product_category_635 635 180 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 180> Gm Araldite 180 Gm Make to> Stock Consumable __export__.product_category_635 180> Gm 1 Standard> Price product.product_uom_unit PCE reference 979 fixed Araldite 180 Gm Make to> Stock Consumable Buy 232 product.product_uom_unit 995 1000 Adhesive> / Araldite / 180> Gm 232 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-aI_hDM8o4GdA TRUE FALSE TRUE __export__.product_category_631 631 3.600> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 3.600> Kg Araldite 3.600 Kg Make to> Stock Consumable __export__.product_category_631 3.600> Kg 1 Standard> Price product.product_uom_unit PCE reference 975 fixed Araldite 3.600 Kg Make to Stock Consumable Buy 1645 product.product_uom_unit 998 1000 Adhesive> / Araldite / 3.600> Kg 1645 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-Yhd665PMzLe2 TRUE FALSE TRUE __export__.product_category_637 637 36 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 36> Gm Araldite 36 Gm Make to> Stock Consumable __export__.product_category_637 36> Gm 1 Standard> Price product.product_uom_unit PCE reference 981 fixed Araldite 36 Gm Make to> Stock Consumable Buy 82 product.product_uom_unit 983 989 Adhesive> / Araldite / 36> Gm 82 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-vALnw9xNbBt4 TRUE FALSE TRUE __export__.product_category_634 634 450 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 450> Gm Araldite 450 Gm Make to> Stock Consumable __export__.product_category_634 450> Gm 1 Standard> Price product.product_uom_unit PCE reference 978 fixed Araldite 450 Gm Make to> Stock Consumable Buy 495 product.product_uom_unit 999 1000 Adhesive> / Araldite / 450> Gm 495 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_977 TRUE FALSE TRUE __export__.product_category_633 633 700 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 700> Gm Araldite 700 Gm Make to> Stock Consumable __export__.product_category_633 700> Gm 1 Standard> Price product.product_uom_unit PCE reference 977 fixed Araldite 700 Gm Make to> Stock Consumable Buy 580 product.product_uom_unit 1000 1000 Adhesive> / Araldite / 700> Gm 580 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_980 TRUE FALSE TRUE __export__.product_category_636 636 90 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Araldite 90> Gm Araldite 90 Gm Make to> Stock Consumable __export__.product_category_636 90> Gm 1 Standard> Price product.product_uom_unit PCE reference 980 fixed Araldite 90 Gm Make to> Stock Consumable Buy 140 product.product_uom_unit 1000 1000 Adhesive> / Araldite / 90> Gm 140 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-ooTaaKYZHO0L TRUE FALSE TRUE __export__.product_category_567 567 1> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed DDL DDL Make> to> Stock Consumable __export__.product_category_567 1> Kg 1 Standard> Price product.product_uom_unit PCE reference 933 fixed DDL Make to> Stock Consumable Buy 62 product.product_uom_unit 999 1000 Adhesive> / DDL / 1> Kg 62 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_1001 TRUE FALSE TRUE __export__.product_category_654 654 Duckorning 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Silicon Black> 789 Silicon Black 789 Make to> Stock Consumable __export__.product_category_654 Duckorning 1 Standard> Price product.product_uom_unit PCE reference 1001 fixed Silicon Black 789 Make to> Stock Consumable Buy 158 product.product_uom_unit 1000 1000 Adhesive> /> Duckorning 158 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-o6nW0AffN1AR TRUE FALSE TRUE __export__.product_category_640 640 20 Gm 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevi Quick 20> Gm Fevi Quick 20 Gm Make to> Stock Consumable __export__.product_category_640 20> Gm 1 Standard> Price product.product_uom_unit PCE reference 983 fixed Fevi Quick 20 Gm Make to> Stock Consumable Buy 85 product.product_uom_unit 999 999 Adhesive> / Fevi Quick / 20> Gm 85 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-j3N5hBDvqYPw TRUE FALSE TRUE __export__.product_category_474 474 1> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevicol> Marine Fevicol Marine Make to> Stock Consumable __export__.product_category_474 1> Kg 1 Standard> Price product.product_uom_unit PCE reference 849 fixed Fevicol> Marine Make to> Stock Consumable Buy 190 product.product_uom_unit 999 1000 Adhesive> / Fevicol Marine / 1> Kg 190 Normal Buy FALSE FALSE FALSE 1 1 > product:1cb06470-015b-11e2-b87f-f46d04dd7c3a.product_product-uYChCNMImNAw TRUE FALSE TRUE __export__.product_category_471 471 10 Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevicol> Marine Fevicol Marine Make to> Stock Consumable __export__.product_category_471 10> Kg 1 Standard> Price product.product_uom_unit PCE reference 846 fixed Fevicol> Marine Make to> Stock Consumable Buy 1700 product.product_uom_unit 995 995 Adhesive> / Fevicol Marine / 10> Kg 1700 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_848 TRUE FALSE TRUE __export__.product_category_473 473 2> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevicol> Marine Fevicol Marine Make to> Stock Consumable __export__.product_category_473 2> Kg 1 Standard> Price product.product_uom_unit PCE reference 848 fixed Fevicol> Marine Make to> Stock Consumable Buy 370 product.product_uom_unit 1000 1000 Adhesive> / Fevicol Marine / 2> Kg 370 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_845 TRUE FALSE TRUE __export__.product_category_470 470 20 Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevicol> Marine Fevicol Marine Make to> Stock Consumable __export__.product_category_470 20> Kg 1 Standard> Price product.product_uom_unit PCE reference 845 fixed Fevicol> Marine Make to> Stock Consumable Buy 3340 product.product_uom_unit 1000 1000 Adhesive> / Fevicol Marine / 20> Kg 3340 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_844 TRUE FALSE TRUE __export__.product_category_469 469 30 Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed fevicol> Marine fevicol Marine Make to> Stock Consumable __export__.product_category_469 30> Kg 1 Standard> Price product.product_uom_unit PCE reference 844 fixed fevicol> Marine Make to> Stock Consumable Buy 4970 product.product_uom_unit 1000 1000 Adhesive> / Fevicol Marine / 30> Kg 4970 Normal Buy FALSE FALSE FALSE 1 1 > __export__.product_product_847 TRUE FALSE TRUE __export__.product_category_472 472 5> Kg 1 1 Standard> Price product.product_uom_unit PCE Real> Time (automated) fixed Fevicol> Marine Fevicol Marine Make to> Stock Consumable __export__.product_category_472 5> Kg 1 Standard> Price product.product_uom_unit PCE reference 847 fixed Fevicol> Marine Make to> Stock Consumable Buy 880 product.product_uom_unit 1000 1000 Adhesive> / Fevicol Marine / 5> Kg 880 Normal Buy FALSE FALSE FALSE 1 1
↧
Ununderstandable error inheriting account.invoice.line ..
I tried to inherit account.invoice.line in the usual way taking a community module as template for that. After having installed my modification, I get the following error:
**TypeError: The model "account.invoice.line" specifies an unexisting parent class "account.invoice.line"
You may need to add a dependency on the parent class' module.**
Any idea what this means?
This is my code:
from openerp.osv import orm
class account_invoice_line(orm.Model):
_inherit = "account.invoice.line"
def product_id_change(
self, cr, uid, ids, product_id, uom_id, qty=0,
name='', type='out_invoice', partner_id=False, fposition_id=False,
price_unit=False, currency_id=False, context=None, company_id=None
):
res = super(account_invoice_line, self).product_id_change(
cr, uid, ids, product_id, uom_id, qty=qty,
name=name, type=type, partner_id=partner_id,
fposition_id=fposition_id, price_unit=price_unit,
currency_id=currency_id, context=context, company_id=company_id
)
if product_id:
product_obj = self.pool.get('product.product')
product = product_obj.browse(cr, uid, product_id, context=context)
if (product and product.description and 'value' in res):
res['value']['name'] = product.description
return res
account_invoice_line()
↧
What is wrong with my inherit of hr_employee?
I am trying to call the sign-in/sign-out change state function: 'attendance_action_change' that's part of hr_employee (a class within the hr_attendance module).
Here's the error I get:
AttributeError: 'super' object has no attribute 'attendance_action_change'Here is my code:
import os
import openerp
import openerp.addons.web.http as http
import openerp.addons.hr_attendance.hr_attendance
PUNCHCARD_TEMPLATE = """<!DOCTYPE html><html><head>
[OMITTED FOR BREVITY]</body></html>
"""
class PunchcardController(http.Controller):
_cp_path = '/my_punchcard'
_inherit = 'hr_attendance.hr_employee'
_name = 'punchcard.employee'
@http.httprequest
def index(self, req, s_action=None, **kw):
"""
Returns a Login screen (input box for user id, and submit button)
The form submits the user id to the PunchIn function/webpage.
"""
template = PUNCHCARD_TEMPLATE
return template
#Creating my own copy of the function to overide the parent, which in turn just calls the parent. The return line is where the code breaks.
def attendance_action_change(self, cr, uid, ids):
"""
Calls the sign-in/sign-out change function 'attendance_action_change' from the inherited hr_employee object
"""
return super(PunchcardController, self).attendance_action_change(cr, uid, ids)
@http.httprequest
def PunchIn(self, req, user_id, **kw):
"""
Authenticates with the server and runs a sign-in/sign-out change
Returns a webpage showing the user id.
"""
print user_id
print str(user_id)
template = "AND NOW USER # " + str(user_id) + " IS IN"
req.session.authenticate('dbname', 'user-name', 'password')
ids=[] #creating my empty list of people to change attendance state
ids.append(user_id) #building my id list of people who will get their attendance state changed (only ever 1 person)
print req.session._uid #verifying I have something to submit as a uid
cr = openerp.pooler.get_db('dbname').cursor() #get a connection to the DB
attendance_change_result = self.attendance_action_change(cr, req.session._uid, ids)
if attendance_change_result:
print "sign in/out changed!"
return template
PunchcardController()
and for completeness, here's the hr_employee class:
(The function I want is the last one in the class: 'attendance_action_change')
class hr_employee(osv.osv):
_inherit = "hr.employee"
_description = "Employee"
def _state(self, cr, uid, ids, name, args, context=None):
result = {}
if not ids:
return result
for id in ids:
result[id] = 'absent'
cr.execute('SELECT hr_attendance.action, hr_attendance.employee_id \
FROM ( \
SELECT MAX(name) AS name, employee_id \
FROM hr_attendance \
WHERE action in (\'sign_in\', \'sign_out\') \
GROUP BY employee_id \
) AS foo \
LEFT JOIN hr_attendance \
ON (hr_attendance.employee_id = foo.employee_id \
AND hr_attendance.name = foo.name) \
WHERE hr_attendance.employee_id IN %s',(tuple(ids),))
for res in cr.fetchall():
result[res[1]] = res[0] == 'sign_in' and 'present' or 'absent'
return result
def _last_sign(self, cr, uid, ids, name, args, context=None):
result = {}
if not ids:
return result
for id in ids:
result[id] = False
cr.execute("""select max(name) as name
from hr_attendance
where action in ('sign_in', 'sign_out') and employee_id = %s""",(id,))
for res in cr.fetchall():
result[id] = res[0]
return result
def _attendance_access(self, cr, uid, ids, name, args, context=None):
# this function field use to hide attendance button to singin/singout from menu
group = self.pool.get('ir.model.data').get_object(cr, uid, 'base', 'group_hr_attendance')
visible = False
if uid in [user.id for user in group.users]:
visible = True
return dict([(x, visible) for x in ids])
_columns = {
'state': fields.function(_state, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'),
'last_sign': fields.function(_last_sign, type='datetime', string='Last Sign'),
'attendance_access': fields.function(_attendance_access, string='Attendance Access', type='boolean'),
}
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
cr.execute('SELECT MAX(name) FROM hr_attendance WHERE employee_id=%s', (emp_id,))
res = cr.fetchone()
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S'))))
def attendance_action_change(self, cr, uid, ids, context=None):
if context is None:
context = {}
action_date = context.get('action_date', False)
action = context.get('action', False)
hr_attendance = self.pool.get('hr.attendance')
warning_sign = {'sign_in': _('Sign In'), 'sign_out': _('Sign Out')}
for employee in self.browse(cr, uid, ids, context=context):
if not action:
if employee.state == 'present': action = 'sign_out'
if employee.state == 'absent': action = 'sign_in'
if not self._action_check(cr, uid, employee.id, action_date, context):
raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the HR Manager to correct attendances.')%(warning_sign[action],))
vals = {'action': action, 'employee_id': employee.id}
if action_date:
vals['name'] = action_date
hr_attendance.create(cr, uid, vals, context=context)
return True
hr_employee()
↧
Why no new client is created after importing a CSV file?
I'm trying to import a CSV file, that goes through the file check.
After a while importing and no error message, the screens goes back to the initial client screen, but no client was imported/created at all.
↧
↧
I am creating a custom field, but whenever I try to add it to my form, I get an error.
I created a custom field named "Test Field" and while creating it I gave it a model of purchase.order
I am trying to create a custom field next to Subtotal in the Quotations and Purchase Order forms.
However, after creating the custom field in: Settings - Database Structures - Fields, while setting its Model to purchase.order, whenever I try adding it next to the Subtotal field on the Quotations form, I get an error that says the following:
"Error occurred while validating the field(s) arch: Invalid XML for View Architecture!"
I don't understand what the problem is and how to fix it.
Thank you for your help, in advance.
OQO
↧
Non-ASCII character '\xe2' in file on line 9, but no encoding declared;
I added a new module for printing report in a module yesterday.Today when I tried to login to the openerp software an error occurs .
OpenERP Server Error
Client Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/http.py", line 204, in dispatch
response["result"] = method(self, **self.params)
File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 864, in authenticate
req.session.authenticate(db, login, password, env)
File "/opt/openerp/server/openerp/addons/web/session.py", line 115, in authenticate
uid = self.proxy('common').authenticate(db, login, password, env)
File "/opt/openerp/server/openerp/addons/web/session.py", line 30, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/opt/openerp/server/openerp/addons/web/session.py", line 103, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/openerp/server/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 433, in dispatch
return fn(*params)
File "/opt/openerp/server/openerp/service/web_services.py", line 444, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/opt/openerp/server/openerp/pooler.py", line 49, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/opt/openerp/server/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/opt/openerp/server/openerp/modules/registry.py", line 193, in get
update_module)
File "/opt/openerp/server/openerp/modules/registry.py", line 219, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/openerp/server/openerp/modules/loading.py", line 350, in load_modules
force, status, report, loaded_modules, update_module)
File "/opt/openerp/server/openerp/modules/loading.py", line 256, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/openerp/server/openerp/modules/loading.py", line 159, in load_module_graph
load_openerp_module(package.name)
File "/opt/openerp/server/openerp/modules/module.py", line 405, in load_openerp_module
__import__('openerp.addons.' + module_name)
File "/opt/openerp/server/openerp/modules/module.py", line 133, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/openerp/server/openerp/addons/print/__init__.py", line 1, in
import report
File "/opt/openerp/server/openerp/addons/print/report/__init__.py", line 1, in
import warranty_info
File "/opt/openerp/server/openerp/addons/print/report/warranty_info.py", line 9
SyntaxError: Non-ASCII character '\xe2' in file /opt/openerp/server/openerp/addons/print/report/warranty_info.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details.
My warranty_info.py file is
import time
from openerp.report import report_sxw
class warranty(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(warranty, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw(
'report.warranty',
'warranty',
'addons/print/report/collection_docket.rml',
parser=warranty
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
↧
programming error column does not exist
Hello, I am getting a new error when I try to search for some records
ProgrammingError: column product_sql_version.product_id does not exist
LINE 1: ...sion."database_server",product_sql_version."name",product_sq...
Im not sure why this is happening because I am not referencing product_sql_version.product_id anywhere in my code, so I dont understand why it thinks that I am. Here is a sample of my code
def on_change_get_sql_ver_set(self, cr, uid, ids, sql_ver_id, context=None):
if sql_ver_id:
sql_ver_obj = self.pool.get('product.sql.version')
sql_rec = sql_ver_obj.browse(cr, uid, sql_ver_id)
ids_set = sql_ver_obj.search(cr, uid, [('database_server','=', sql_rec.database_server)])
recs = {}
recs['product_sql_version_id'] = ids_set
return {'value': recs}
I created a new table called product_sql_version and it has fields named: version, database_server, and name. It does not have a field named product_id. What I am trying to do is return a list of ids to a many2one field based on a selection from another many2one field, but it gives an error because it thinks I am referencing a product_id field that doesnt exist. Does anyone know why this is happening?
here is what the entire error says
OpenERP Server Error
Client Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\http.py", line 204, in dispatch
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\controllers\main.py", line 1128, in call_kw
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\controllers\main.py", line 1120, in _call_kw
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\session.py", line 42, in proxy
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\session.py", line 30, in proxy_method
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\session.py", line 103, in send
Server Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\web\session.py", line 89, in send
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\netsvc.py", line 292, in dispatch_rpc
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\osv.py", line 188, in execute_kw
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\osv.py", line 131, in wrapper
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\osv.py", line 197, in execute
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\osv.py", line 185, in execute_cr
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\openerp\addons\sale_custom\sale_custom.py", line 51, in on_change_get_sql_ver_set
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\orm.py", line 484, in __getattr__
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\orm.py", line 399, in __getitem__
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\orm.py", line 3604, in read
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\osv\orm.py", line 3656, in _read_flat
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\sql_db.py", line 161, in wrapper
File "C:\Program Files (x86)\OpenERP 7.0-20130722-231026\Server\server\.\openerp\sql_db.py", line 226, in execute
ProgrammingError: column product_sql_version.product_id does not exist
LINE 1: ...sion."database_server",product_sql_version."name",product_sq...
↧
TypeError: Object has no method 'split'
Hello, I have a method where I am trying to append a set of ids to a many2one field base on certain criteria. I get the set of ids just fine, but when I return the list using an onchange method, then I get this error
TypeError: Object 61 has no method 'split'
This is the method that I am using
def on_change_get_sql_ver_set(self, cr, uid, ids, sql_ver_id, context=None):
if sql_ver_id:
sql_ver_obj = self.pool.get('product.sql.version')
sql_rec = sql_ver_obj.browse(cr, uid, sql_ver_id)
ids_set = sql_ver_obj.search(cr, uid, [('database_server','=', sql_rec.database_server)])
# raise osv.except_osv('UserError',ids_set)
recs = {}
recs['product_sql_version_id'] = ids_set #check ids_set
return {'value': recs}
I will need to add more search conditions to this method to do what I need, but right now I just want to try and add this set to the many2one field on the form. does anyone know how I can add the set of returned data/ids to the many2one field
↧
↧
Error: QWeb2 - template['PosTicket']: Runtime Error: TypeError: round_pr is not a function
i have some error:
Error: QWeb2 - template['PosTicket']: Runtime Error: TypeError: round_pr is not a function
what can i do?
↧
TypeError on page refresh
When I refresh the browser at the form view of a custom module I get this Error:
TypeError: this.$pager is undefined
http:///web/webclient/js?db=openerp:3467
What does that mean? How can I fix it?
Thanks.
↧
Error on reporting \ sales
Hi,
When i go to the root menu "reporting" then "Sales analysis" i immediatly face this error message :
I try to raise a new DB, same issue !
Server Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2740, in read_group
cr.execute(query, where_clause_params)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "GROUP"
LINE 6: GROUP BY "sale_report"."user_id","sale_report__u...
Anyone have an idea ?
Julien
↧
Database Creation Error
I am facing the following error in my development environment when attempting to create a new database:
Client Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch
response["result"] = method(self, **self.params)
File "/usr/lib/pymodules/python2.7/openerp/addons/auth_signup/controllers/main.py", line 39, in get_config
'signup': icp.get_param(cr, openerp.SUPERUSER_ID, 'auth_signup.allow_uninvited') == 'True',
File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_config_parameter.py", line 74, in get_param
ids = self.search(cr, uid, [('key','=',key)], context=context)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2367, in search
return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4939, in _search
cr.execute('SELECT "%s".id FROM ' % self._table + from_clause + where_str + order_by + limit_str + offset_str, where_clause_params)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
ProgrammingError: relation "ir_config_parameter" does not exist
LINE 1: SELECT "ir_config_parameter".id FROM "ir_config_parameter" W...
^
The database is created but cannot login.
What could be the problem here?
↧
↧
Sales Analysis error - LINE 1: ...report.id FROM "sale_report" WHERE sale_report.id IN
When I try to open a Sales Analysis report in /Reporting/Sales Analysis Group By /salesperson/Partner or any combination in the filters I get this error.
Client Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/http.py", line 195, in dispatch
response["result"] = method(self, **self.params)
File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1078, in call_kw
return self._call_kw(req, model, method, args, kwargs)
File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1070, in _call_kw
return getattr(req.session.model(model), method)(*args, **kwargs)
File "/opt/openerp/server/openerp/addons/web/session.py", line 43, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
File "/opt/openerp/server/openerp/addons/web/session.py", line 31, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/opt/openerp/server/openerp/addons/web/session.py", line 104, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
Server Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/session.py", line 90, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/openerp/server/openerp/netsvc.py", line 289, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 614, in dispatch
res = fn(db, uid, *params)
File "/opt/openerp/server/openerp/osv/osv.py", line 169, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/opt/openerp/server/openerp/osv/osv.py", line 123, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/openerp/server/openerp/osv/osv.py", line 179, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/server/openerp/osv/osv.py", line 166, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/server/openerp/osv/orm.py", line 2690, in read_group
data = self.read(cr, uid, data_ids, [groupby], context=context)
File "/opt/openerp/server/openerp/osv/orm.py", line 3606, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/opt/openerp/server/openerp/osv/orm.py", line 3658, in _read_flat
cr.execute(query, [tuple(sub_ids)] + rule_params)
File "/opt/openerp/server/openerp/sql_db.py", line 162, in wrapper
return f(self, *args, **kwargs)
File "/opt/openerp/server/openerp/sql_db.py", line 227, in execute
res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: ...report.id FROM "sale_report" WHERE sale_report.id IN (false,...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Thanks for your help,
↧
Resolving "Constraint Error: Invoice Number must be unique per Company!" on Validating a Purchase Invoice?
Constraint Error
Invoice Number must be unique per Company!
-----------------------------------------------------------
From what I can see, the invoice number is unique.
↧
How to rollback a record if exception occurs?
I am working on a credit card payment module, and am having trouble with rolling back a transaction if an error occurs.
I have a wizard that accepts the credit card info, and when the button is clicked to submit it, it still writes the record to the table as if it was processed.
I would like to rollback, or delete the record if an error occurred, but cant seem to figure out how to do it in OpenERP v7.
Can anyone explain how to do this? Thank you
↧