@@ -171,13 +171,14 @@
- [[ repeatIn(voucher.move_ids,'move_ids') ]] [[ (not move_ids) and removeParentNode('blockTable') ]]
+ [[ repeatIn(voucher.move_ids,'move_ids') ]]
[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] :
[[ move_ids.account_id.name ]]
[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]
+
[[ move_ids.debit ]]
diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py
old mode 100644
new mode 100755
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index d1dc30c6b67..6fd5204d318 100755
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -214,7 +214,7 @@ class account_voucher(osv.osv):
for il in iml:
if il['account_analytic_id']:
- if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
+ if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
@@ -244,7 +244,7 @@ class account_voucher(osv.osv):
diff_currency_p = inv.currency_id.id <> company_currency
total = 0
- if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
+ if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
@@ -508,12 +508,11 @@ class VoucherLine(osv.osv):
res.append(self.move_line_get_item(cr, uid, line, context))
return res
- def onchange_partner(self, cr, uid, ids, partner_id, ttype,type1):
+ def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1):
if not partner_id:
return {'value' : {'account_id' : False, 'type' : False ,'amount':False}}
obj = self.pool.get('res.partner')
account_id = False
-
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
balance = obj.browse(cr,uid,partner_id).credit
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 089ec8d1614..28233ad6f8c 100755
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -231,8 +231,8 @@
form
form,tree
- [('type','=','journal_sale_voucher')]
- {'type':'journal_sale_voucher'}
+ [('type','=','journal_sale_vou')]
+ {'type':'journal_sale_vou'}
diff --git a/addons/account_voucher/wizard/open_voucher.py b/addons/account_voucher/wizard/open_voucher.py
index 253d220dbb9..c88819df315 100644
--- a/addons/account_voucher/wizard/open_voucher.py
+++ b/addons/account_voucher/wizard/open_voucher.py
@@ -45,7 +45,7 @@ _types = {
'rec_voucher':'Cash Receipt Voucher',
'bank_rec_voucher':'Bank Receipt Voucher',
'cont_voucher':'Contra Voucher',
- 'journal_sale_voucher':'Journal Sale Voucher',
+ 'journal_sale_vou':'Journal Sale Voucher',
'journal_pur_voucher':'Journal Purchase Voucher'
}
_states = {
@@ -62,7 +62,7 @@ _voucher_fields = {
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
- ('journal_sale_voucher','Journal Sale Voucher'),
+ ('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
'state': {'string':'State', 'type':'selection', 'selection':[
('draft','Draft'),
diff --git a/addons/auction/report/auction_artists.py b/addons/auction/report/auction_artists.py
index 91843906dff..c66531938f4 100644
--- a/addons/auction/report/auction_artists.py
+++ b/addons/auction/report/auction_artists.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_artists(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_artists, self).__init__(cr, uid, name, context)
+ super(auction_artists, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_bids.py b/addons/auction/report/auction_bids.py
index 560160ac008..2153d246428 100644
--- a/addons/auction/report/auction_bids.py
+++ b/addons/auction/report/auction_bids.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_bids(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_bids, self).__init__(cr, uid, name, context)
+ super(auction_bids, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/auction_buyer_result.py b/addons/auction/report/auction_buyer_result.py
index 97ab54cc056..017f62eb5d0 100644
--- a/addons/auction/report/auction_buyer_result.py
+++ b/addons/auction/report/auction_buyer_result.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_buyer_result(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_buyer_result, self).__init__(cr, uid, name, context)
+ super(auction_buyer_result, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_catelog.py b/addons/auction/report/auction_catelog.py
index 70b2b6db917..b9b8dad2dc7 100644
--- a/addons/auction/report/auction_catelog.py
+++ b/addons/auction/report/auction_catelog.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_catelog(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_catelog, self).__init__(cr, uid, name, context)
+ super(auction_catelog, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_objects.py b/addons/auction/report/auction_objects.py
index 879b407c184..0879c7770e5 100644
--- a/addons/auction/report/auction_objects.py
+++ b/addons/auction/report/auction_objects.py
@@ -26,7 +26,7 @@ from report import report_sxw
class auction_objects(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_objects, self).__init__(cr, uid, name, context)
+ super(auction_objects, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
#'lines': self.lines
diff --git a/addons/auction/report/auction_result.py b/addons/auction/report/auction_result.py
index 48f21d73669..77ba88b9486 100644
--- a/addons/auction/report/auction_result.py
+++ b/addons/auction/report/auction_result.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_result(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_result, self).__init__(cr, uid, name, context)
+ super(auction_result, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_total_rml.py b/addons/auction/report/auction_total_rml.py
index cc103e7c250..82c068bce26 100644
--- a/addons/auction/report/auction_total_rml.py
+++ b/addons/auction/report/auction_total_rml.py
@@ -29,7 +29,7 @@ from report import report_sxw
class auction_total_rml(report_sxw.rml_parse):
total_obj=[]
def __init__(self, cr, uid, name, context):
- super(auction_total_rml, self).__init__(cr, uid, name, context)
+ super(auction_total_rml, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'sum_taxes':self.sum_taxes,
diff --git a/addons/auction/report/bids_lots.py b/addons/auction/report/bids_lots.py
index 8358e76ea2a..e77d7948c92 100644
--- a/addons/auction/report/bids_lots.py
+++ b/addons/auction/report/bids_lots.py
@@ -28,7 +28,7 @@ from report import report_sxw
class bids_lots(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(bids_lots, self).__init__(cr, uid, name, context)
+ super(bids_lots, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/bids_phones_details.py b/addons/auction/report/bids_phones_details.py
index bf5e5343074..73899f957cd 100644
--- a/addons/auction/report/bids_phones_details.py
+++ b/addons/auction/report/bids_phones_details.py
@@ -28,7 +28,7 @@ from report import report_sxw
class bids_phones_details(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(bids_phones_details, self).__init__(cr, uid, name, context)
+ super(bids_phones_details, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/buyer_form_report.py b/addons/auction/report/buyer_form_report.py
index 20d93cef754..291be748930 100644
--- a/addons/auction/report/buyer_form_report.py
+++ b/addons/auction/report/buyer_form_report.py
@@ -30,7 +30,7 @@ class buyer_form_report(report_sxw.rml_parse):
count=0
c=0
def __init__(self, cr, uid, name, context):
- super(buyer_form_report, self).__init__(cr, uid, name, context)
+ super(buyer_form_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'sum_taxes': self.sum_taxes,
diff --git a/addons/auction/report/buyer_list.py b/addons/auction/report/buyer_list.py
index eaa44f22c0c..83799ba5169 100644
--- a/addons/auction/report/buyer_list.py
+++ b/addons/auction/report/buyer_list.py
@@ -34,7 +34,7 @@ class buyer_list(report_sxw.rml_parse):
sum_buyer_price_val=0.0
sum_lot_val=0.0
def __init__(self, cr, uid, name, context):
- super(buyer_list, self).__init__(cr, uid, name, context)
+ super(buyer_list, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'lines_lots_from_auction' : self.lines_lots_from_auction,
diff --git a/addons/auction/report/catelogwithpictures.py b/addons/auction/report/catelogwithpictures.py
index f3f954a2908..4063f884ad2 100644
--- a/addons/auction/report/catelogwithpictures.py
+++ b/addons/auction/report/catelogwithpictures.py
@@ -26,7 +26,7 @@ from report import report_sxw
class catelogwithpictures(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(catelogwithpictures, self).__init__(cr, uid, name, context)
+ super(catelogwithpictures, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/deposit_seller.py b/addons/auction/report/deposit_seller.py
index 4e0a184ffc7..f39fd6b5596 100644
--- a/addons/auction/report/deposit_seller.py
+++ b/addons/auction/report/deposit_seller.py
@@ -28,7 +28,7 @@ from report import report_sxw
class deposit_seller(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(deposit_seller, self).__init__(cr, uid, name, context)
+ super(deposit_seller, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/lots_list.py b/addons/auction/report/lots_list.py
index 32d23accb90..ad5e678c2f3 100644
--- a/addons/auction/report/lots_list.py
+++ b/addons/auction/report/lots_list.py
@@ -26,7 +26,7 @@ from report import report_sxw
class lots_list(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list, self).__init__(cr, uid, name, context)
+ super(lots_list, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'bid_line' : self.bid_line
diff --git a/addons/auction/report/lots_list_inventory.py b/addons/auction/report/lots_list_inventory.py
index 42a993ccc7a..329591cf3ac 100644
--- a/addons/auction/report/lots_list_inventory.py
+++ b/addons/auction/report/lots_list_inventory.py
@@ -26,7 +26,7 @@ from report import report_sxw
class lots_list_inventory(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list_inventory, self).__init__(cr, uid, name, context)
+ super(lots_list_inventory, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'bid_line' : self.bid_line
diff --git a/addons/auction/report/lots_list_landscape.py b/addons/auction/report/lots_list_landscape.py
index b638c6e54c4..99760d78715 100644
--- a/addons/auction/report/lots_list_landscape.py
+++ b/addons/auction/report/lots_list_landscape.py
@@ -26,7 +26,7 @@ from report import report_sxw
class lots_list_llandscape(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list_landscape, self).__init__(cr, uid, name, context)
+ super(lots_list_landscape, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/report_lot_bar_code.py b/addons/auction/report/report_lot_bar_code.py
index 3d9f8df4330..4767fe68c28 100644
--- a/addons/auction/report/report_lot_bar_code.py
+++ b/addons/auction/report/report_lot_bar_code.py
@@ -26,7 +26,7 @@ from report import report_sxw
class auction_code_produit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_code_produit, self).__init__(cr, uid, name, context)
+ super(auction_code_produit, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/seller_form_report.py b/addons/auction/report/seller_form_report.py
index a64759b2547..d0febfde712 100644
--- a/addons/auction/report/seller_form_report.py
+++ b/addons/auction/report/seller_form_report.py
@@ -28,7 +28,7 @@ from osv import osv
class seller_form_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(seller_form_report, self).__init__(cr, uid, name, context)
+ super(seller_form_report, self).__init__(cr, uid, name, context=context)
lot=self.pool.get('auction.lots').browse(cr,uid,uid)
#address=lot.bord_vnd_id.address_get(self.cr,self.uid,[partner.id])
# partner=lot.bord_vnd_id.partner_id
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index ee23e790e7b..8467355addb 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -63,18 +63,18 @@ class audittrail_rule(osv.osv):
_('WARNING:audittrail is not part of the pool'),
_('Change audittrail depends -- Setting rule as DRAFT'))
self.write(cr, uid, [thisrule.id], {"state": "draft"})
- val={
- "name":'View Log',
- "res_model":'audittrail.log',
- "src_model":thisrule.object_id.model,
- "domain":"[('res_id', '=', active_id)]"
-
- }
- id=self.pool.get('ir.actions.act_window').create(cr, uid, val)
- self.write(cr, uid, ids, {"state": "subscribed","action_id":id})
- keyword = 'client_action_relate'
- value = 'ir.actions.act_window,'+str(id)
- res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False)
+ val={
+ "name":'View Log',
+ "res_model":'audittrail.log',
+ "src_model":thisrule.object_id.model,
+ "domain":"[('object_id','=',"+str(thisrule.object_id.id)+"),('res_id', '=', active_id)]"
+
+ }
+ id=self.pool.get('ir.actions.act_window').create(cr, uid, val)
+ self.write(cr, uid, [thisrule.id], {"state": "subscribed","action_id":id})
+ keyword = 'client_action_relate'
+ value = 'ir.actions.act_window,'+str(id)
+ res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False)
return True
@@ -84,14 +84,14 @@ class audittrail_rule(osv.osv):
if thisrule.id in self.__functions :
for function in self.__functions[thisrule.id]:
setattr(function[0], function[1], function[2])
- w_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('name','=','View Log'),('res_model','=','audittrail.log'),('src_model','=',thisrule.object_id.model)])
- self.pool.get('ir.actions.act_window').unlink(cr, uid,w_id )
- val_obj=self.pool.get('ir.values')
- value="ir.actions.act_window"+','+str(w_id[0])
- val_id=val_obj.search(cr, uid, [('model','=',thisrule.object_id.model),('value','=',value)])
- if val_id:
- res = ir.ir_del(cr, uid, val_id[0])
- self.write(cr, uid, ids, {"state": "draft"})
+ w_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('name','=','View Log'),('res_model','=','audittrail.log'),('src_model','=',thisrule.object_id.model)])
+ self.pool.get('ir.actions.act_window').unlink(cr, uid,w_id )
+ val_obj=self.pool.get('ir.values')
+ value="ir.actions.act_window"+','+str(w_id[0])
+ val_id=val_obj.search(cr, uid, [('model','=',thisrule.object_id.model),('value','=',value)])
+ if val_id:
+ res = ir.ir_del(cr, uid, val_id[0])
+ self.write(cr, uid, [thisrule.id], {"state": "draft"})
return True
audittrail_rule()
diff --git a/addons/audittrail/security/ir.model.access.csv b/addons/audittrail/security/ir.model.access.csv
index 90895f202c4..ac367182f26 100644
--- a/addons/audittrail/security/ir.model.access.csv
+++ b/addons/audittrail/security/ir.model.access.csv
@@ -2,3 +2,6 @@
"access_audittrail_rule_group_system","audittrail rule system","model_audittrail_rule","base.group_system",1,1,1,1
"access_audittrail_log_group_system","audittrail log system","model_audittrail_log","base.group_system",1,1,1,1
"access_audittrail_logline_group_system","audittrail log line system","model_audittrail_log_line","base.group_system",1,1,1,1
+"access_audittrail_rule_all_users","audittrail rule all","model_audittrail_rule","base.group_user",1,0,0,0
+"access_audittrail_log_all_users","audittrail log all","model_audittrail_log","base.group_user",1,0,1,0
+"access_audittrail_log_line_all_users","audittrail log line all","model_audittrail_log_line","base.group_user",1,0,1,0
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index b00a5745935..4e6712010f5 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -34,6 +34,13 @@ class res_partner_contact(osv.osv):
res = [(r['shortcut'], r['name']) for r in res if r['domain']=='contact']
return res
+ def _main_job(self, cr, uid, ids, fields, arg, context=None):
+ res = dict.fromkeys(ids, False)
+ for contact in self.browse(cr, uid, ids, context):
+ if contact.job_ids:
+ res[contact.id] = contact.job_ids[0].name_get()[0]
+ return res
+
_columns = {
'name': fields.char('Last Name', size=30,required=True),
'first_name': fields.char('First Name', size=30),
@@ -47,7 +54,7 @@ class res_partner_contact(osv.osv):
'active' : fields.boolean('Active'),
'partner_id':fields.related('job_ids','address_id','partner_id',type='many2one', relation='res.partner', string='Main Employer'),
'function_id':fields.related('job_ids','function_id',type='many2one', relation='res.partner.function', string='Main Function'),
- 'job_id':fields.related('job_ids',type='many2one', relation='res.partner.job', string='Main Job'),
+ 'job_id': fields.function(_main_job, method=True, type='many2one', relation='res.partner.job', string='Main Job'),
'email': fields.char('E-Mail', size=240),
}
_defaults = {
diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml
index 9b2a9c179fc..8c9740f2be9 100644
--- a/addons/base_contact/base_contact_view.xml
+++ b/addons/base_contact/base_contact_view.xml
@@ -281,7 +281,7 @@
form
-
+
diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py
index bcca40a153e..79824d227c6 100644
--- a/addons/base_report_creator/base_report_creator.py
+++ b/addons/base_report_creator/base_report_creator.py
@@ -259,8 +259,8 @@ class report_creator(osv.osv):
ret_str = ret_str[0:len(ret_str)-3]
if ret_str.endswith('or'):
ret_str = ret_str[0:len(ret_str)-2]
- ret_str = ret_str.strip()
- return ret_str
+ ret_str = ret_str.strip()
+ return ret_str % {'uid' : uid}
def _id_get(self, cr, uid, id, context):
# return 'min(sale_order_line.id)'
diff --git a/addons/base_report_creator/base_report_creator_view.xml b/addons/base_report_creator/base_report_creator_view.xml
index 7ae858012ed..b5ee6227bb2 100644
--- a/addons/base_report_creator/base_report_creator_view.xml
+++ b/addons/base_report_creator/base_report_creator_view.xml
@@ -86,6 +86,8 @@
+
+
@@ -97,6 +99,7 @@
+ Custom Report
base_report_creator.report
form
tree,form
diff --git a/addons/base_report_creator/wizard/wiz_set_filter_fields.py b/addons/base_report_creator/wizard/wiz_set_filter_fields.py
index a97be887803..851eed0dbb1 100644
--- a/addons/base_report_creator/wizard/wiz_set_filter_fields.py
+++ b/addons/base_report_creator/wizard/wiz_set_filter_fields.py
@@ -23,6 +23,7 @@
import wizard
import netsvc
import pooler
+import tools
relation_type=['one2many','many2one','many2many']
char_type = ['char','text','selection']
@@ -122,25 +123,29 @@ def _set_filter_value(self, cr, uid, data, context):
model_pool = pooler.get_pool(cr.dbname).get(model_name)
table_name = model_pool._table
model_name = model_pool._description
-
+
if field_type:
if field_type == 'boolean':
if value_data == 1:
value_data = 'true'
else:
value_data = 'false'
+
+ if field_type in ['float','integer']:
+ value_data = value_data or 0
+
if field_type == 'many2many' and value_data and len(value_data):
fields_list = set_field_operator(self,table_name+"."+field_data['name'],field_data['ttype'],form_data['operator'],value_data[0][2])
else:
fields_list = set_field_operator(self,table_name+"."+field_data['name'],field_data['ttype'],form_data['operator'],value_data)
if fields_list:
create_dict = {
- 'name':model_name + "/" +field_data['field_description'] +" "+ mapping_fields[form_data['operator']] + " " + str(fields_list[2]) + " ",
- 'expression':' '.join(fields_list),
+ 'name':model_name + "/" +field_data['field_description'] +" "+ mapping_fields[form_data['operator']] + " " + tools.ustr(fields_list[2]) + " ",
+ 'expression':' '.join(map(tools.ustr,fields_list)),
'report_id':data['id'],
'condition' : form_data['condition']
}
- pooler.get_pool(cr.dbname).get('base_report_creator.report.filter').create(cr,uid,create_dict)
+ pooler.get_pool(cr.dbname).get('base_report_creator.report.filter').create(cr,uid,create_dict,context)
#end if field_type == 'many2many' and value_data and len(value_data):
# pooler.get_pool(cr.dbname).get('custom.report.filter').create(cr,uid,form_data)
#end if field_type:
diff --git a/addons/base_vat/partner.py b/addons/base_vat/partner.py
index ca91ab33562..ca6460620e9 100644
--- a/addons/base_vat/partner.py
+++ b/addons/base_vat/partner.py
@@ -378,10 +378,10 @@ class res_partner(osv.osv):
22: 'K',
23: 'E',
}
-
- if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'):
+ #Legal persons with profit aim
+ if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'U', 'V'):
try:
- int(vat[1:])
+ int(vat[1:8])
except:
return False
sum = mult_add(2, int(vat[1])) + int(vat[2]) + \
@@ -391,10 +391,11 @@ class res_partner(osv.osv):
check = 10 - (sum % 10)
if check == 10:
check = 0
- if check != int(vat[8]):
- return False
+# if check != int(vat[8]):
+# return False
return True
- elif vat[0] in ('N', 'P', 'Q', 'S'):
+ #Legal persons with non-profit aim
+ elif vat[0] in ('N', 'P', 'Q', 'R', 'S', 'W'):
try:
int(vat[1:8])
except:
@@ -408,17 +409,26 @@ class res_partner(osv.osv):
if check != vat[8]:
return False
return True
- elif vat[0] in ('K', 'L', 'M', 'X'):
+ #Foreign natural persons, under age 14 or non-residents
+ elif vat[0] in ('K', 'L', 'M', 'X', 'Y', 'Z'):
+ if vat[0] == 'Y':
+ check_value = '1' + vat[1:8]
+ elif vat[0] == 'Z':
+ check_value = '2' + vat[1:8]
+ else:
+ check_value = vat[1:8]
+
try:
- int(vat[1:8])
+ int(check_value)
except:
return False
- check = 1 + (int(vat[1:8]) % 23)
+ check = 1 + (int(check_value) % 23)
check = conv[check]
if check != vat[8]:
return False
return True
+ #Spanish natural persons
else:
try:
int(vat[:8])
@@ -905,7 +915,8 @@ class res_partner(osv.osv):
except:
return False
- if len(vat) == 10:
+ if len(vat) >= 2 and len(vat) <= 10:
+ vat = (10 - len(vat)) * '0' + vat
sum = 7 * int(vat[0]) + 5 * int(vat[1]) + 3 * int(vat[2]) + \
2 * int(vat[3]) + 1 * int(vat[4]) + 7 * int(vat[5]) + \
5 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index 3b425ba0f3c..7f62d43922b 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -276,6 +276,7 @@
crm.case.form
crm.case
form
+
-
+
- [[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]
+ [[ note or removeParentNode('blockTable') ]]
- [[ note or removeParentNode('table') ]]
+ [[ l.note ]]
-
@@ -328,6 +326,11 @@
-->
+ [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]
+ [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]
+
+ [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]
+ [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]
[[user.company_id.name]]
[[ user.company_id.partner_id.address[0].street ]]
[[ (user.company_id.partner_id.address[0].street2 or '')]]
@@ -354,10 +357,12 @@
+
[[ _space(_get_ref(o)) ]]
-
+ [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]
+ [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]
[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]
[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]
@@ -375,4 +380,4 @@
-
+
\ No newline at end of file
diff --git a/addons/l10n_ch/report/tiny_sxw2rml.py b/addons/l10n_ch/report/tiny_sxw2rml.py
deleted file mode 100755
index e7a5422b6ec..00000000000
--- a/addons/l10n_ch/report/tiny_sxw2rml.py
+++ /dev/null
@@ -1,342 +0,0 @@
-
-
-#!/usr/bin/python
-#coding: latin-1
-
-##############################################################################
-#
-# Copyright (c):
-#
-# 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de)
-# 2005 Fabien Pinckaers, TINY SPRL. (http://tiny.be)
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contact a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-"""
-Tiny SXW2RML - The Tiny ERP's report engine
-
-Tiny SXW2RMLis part of the Tiny report project.
-Tiny Report is a module that allows you to render high quality PDF document
-from an OpenOffice template (.sxw) and any relationnal database.
-
-The whole source code is distributed under the terms of the
-GNU Public Licence.
-
-(c) 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de)
-(c) 2005-TODAY, Fabien Pinckaers - Tiny sprl
-"""
-__version__ = '0.9'
-
-
-import re
-import string
-import os
-import time
-import zipfile
-import xml.dom.minidom
-from reportlab.lib.units import toLength
-import optparse
-
-parser = optparse.OptionParser(
- version="Tiny Report v%s" % __version__,
- usage = 'tiny_sxw2rml.py [options] file.sxw')
-parser.add_option("-v", "--verbose", default=False, dest="verbose", help="enable basic debugging")
-parser.add_option("-o", "--output", dest="output", default='.', help="directory of image output")
-(opt, args) = parser.parse_args()
-if len(args) != 1:
- parser.error("incorrect number of arguments")
-
-class DomApiGeneral:
- """General DOM API utilities."""
- def __init__(self,content_string="",file=""):
- self.content_string = content_string
- self.re_digits = re.compile(r"(.*?\d)(pt|cm|mm|inch|in)")
-
- def _unitTuple(self,string):
- """Split values and units to a tuple."""
- temp = self.re_digits.findall(string)
- if not temp:
- return (string,"")
- else:
- return (temp[0])
-
- def stringPercentToFloat(self,string):
- temp = string.replace("""%""","")
- return float(temp)/100
-
- def findChildrenByName(self,parent,name,attr_dict={}):
- """Helper functions. Does not work recursively.
- Optional: also test for certain attribute/value pairs."""
- children = []
- for c in parent.childNodes:
- if c.nodeType == c.ELEMENT_NODE and c.nodeName == name:
- children.append(c)
- if attr_dict == {}:
- return children
- else:
- return self._selectForAttributes(nodelist=children,attr_dict=attr_dict)
-
- def _selectForAttributes(self,nodelist,attr_dict):
- "Helper function."""
- selected_nodes = []
- for n in nodelist:
- check = 1
- for a in attr_dict.keys():
- if n.getAttribute(a) != attr_dict[a]:
- # at least one incorrect attribute value?
- check = 0
- if check:
- selected_nodes.append(n)
- return selected_nodes
-
- def _stringToTuple(self,s):
- """Helper function."""
- try:
- temp = string.split(s,",")
- return int(temp[0]),int(temp[1])
- except:
- return None
-
- def _tupleToString(self,t):
- try:
- return self.openOfficeStringUtf8("%s,%s" % (t[0],t[1]))
- except:
- return None
-
- def _lengthToFloat(self,value):
- v = value
- if not self.re_digits.search(v):
- return v
- try:
- if v[-4:] == "inch":
- # OO files use "inch" instead of "in" in Reportlab units
- v = v[:-2]
- except:
- pass
- try:
- c = round(toLength(v))
- return c
- except:
- return v
-
- def openOfficeStringUtf8(self,string):
- if type(string) == unicode:
- return string.encode("utf-8")
- tempstring = unicode(string,"cp1252").encode("utf-8")
- return tempstring
-
-class DomApi(DomApiGeneral):
- """This class provides a DOM-API for XML-Files from an SXW-Archive."""
- def __init__(self,xml_content,xml_styles):
- DomApiGeneral.__init__(self)
- self.content_dom = xml.dom.minidom.parseString(xml_content)
- self.styles_dom = xml.dom.minidom.parseString(xml_styles)
- body = self.content_dom.getElementsByTagName("office:body")
- self.body = body and body[0]
-
- # TODO:
- self.style_dict = {}
- self.style_properties_dict = {}
-
- # ******** always use the following order:
- self.buildStyleDict()
- self.buildStylePropertiesDict()
-
- self.page_master = self.styles_dom.getElementsByTagName("style:page-master")[0]
- self.document = self.content_dom.getElementsByTagName("office:document-content")[0]
-
- def buildStylePropertiesDict(self):
- for s in self.style_dict.keys():
- self.style_properties_dict[s] = self.getStylePropertiesDict(s)
-
- def updateWithPercents(self,dict,updatedict):
- """Sometimes you find values like "115%" in the style hierarchy."""
- if not updatedict:
- # no style hierarchies for this style? =>
- return
- new_updatedict = copy.copy(updatedict)
- for u in new_updatedict.keys():
- try:
- if new_updatedict[u].find("""%""") != -1 and dict.has_key(u):
- number = float(self.re_digits.search(dict[u]).group(1))
- unit = self.re_digits.search(dict[u]).group(2)
- new_number = self.stringPercentToFloat(new_updatedict[u]) * number
- if unit == "pt":
- new_number = int(new_number)
- # no floats allowed for "pt"
- # OOo just takes the int, does not round (try it out!)
- new_updatedict[u] = "%s%s" % (new_number,unit)
- else:
- dict[u] = new_updatedict[u]
- except:
- dict[u] = new_updatedict[u]
- dict.update(new_updatedict)
-
- def normalizeStyleProperties(self):
- """Transfer all style:style-properties attributes from the
- self.style_properties_hierarchical dict to the automatic-styles
- from content.xml. Use this function to preprocess content.xml for
- XSLT transformations etc.Do not try to implement this function
- with XSlT - believe me, it's a terrible task..."""
- styles_styles = self.styles_dom.getElementsByTagName("style:style")
- automatic_styles = self.content_dom.getElementsByTagName("office:automatic-styles")[0]
- for s in styles_styles:
- automatic_styles.appendChild(s.cloneNode(deep=1))
- content_styles = self.content_dom.getElementsByTagName("style:style")
- # these are the content_styles with styles_styles added!!!
- for s in content_styles:
- c = self.findChildrenByName(s,"style:properties")
- if c == []:
- # some derived automatic styles do not have "style:properties":
- temp = self.content_dom.createElement("style:properties")
- s.appendChild(temp)
- c = self.findChildrenByName(s,"style:properties")
- c = c[0]
- dict = self.style_properties_dict[(s.getAttribute("style:name")).encode("latin-1")] or {}
- for attribute in dict.keys():
- c.setAttribute(self.openOfficeStringUtf8(attribute),self.openOfficeStringUtf8(dict[attribute]))
-
- def transferStylesXml(self):
- """Transfer certain sub-trees from styles.xml to the normalized content.xml
- (see above). It is not necessary to do this - for example - with paragraph styles.
- the "normalized" style properties contain all information needed for
- further processing."""
- # TODO: What about table styles etc.?
- page_master = self.page_master
- outline_styles = self.styles_dom.getElementsByTagName("text:outline-style")
- t = self.content_dom.createElement("transferredfromstylesxml")
- self.document.insertBefore(t,self.body)
- t_new = self.body.previousSibling
- try:
- t_new.appendChild(page_master.cloneNode(deep=1))
- t_new.appendChild(outline_styles[0].cloneNode(deep=1))
- except:
- pass
-
- def normalizeLength(self):
- """Normalize all lengthes to floats (i.e: 1 inch = 72).
- Always use this after "normalizeContent" and "transferStyles"!"""
- # TODO: The complex attributes of table cell styles are not transferred yet.
- #all_styles = self.content_dom.getElementsByTagName("style:properties")
- #all_styles += self.content_dom.getElementsByTagName("draw:image")
- all_styles = self.content_dom.getElementsByTagName("*")
- for s in all_styles:
- for x in s._attrs.keys():
- v = s.getAttribute(x)
- s.setAttribute(x,"%s" % self._lengthToFloat(v))
- # convert float to string first!
-
- def normalizeTableColumns(self):
- """Handle this strange table:number-columns-repeated attribute."""
- columns = self.content_dom.getElementsByTagName("table:table-column")
- for c in columns:
- if c.hasAttribute("table:number-columns-repeated"):
- number = int(c.getAttribute("table:number-columns-repeated"))
- c.removeAttribute("table:number-columns-repeated")
- for i in range(number-1):
- (c.parentNode).insertBefore(c.cloneNode(deep=1),c)
-
- def buildStyleDict(self):
- """Store all style:style-nodes from content.xml and styles.xml in self.style_dict.
- Caution: in this dict the nodes from two dom apis are merged!"""
- for st in (self.styles_dom,self.content_dom):
- for s in st.getElementsByTagName("style:style"):
- name = s.getAttribute("style:name").encode("latin-1")
- self.style_dict[name] = s
- return True
-
- def toxml(self):
- return self.content_dom.toxml(encoding="utf-8")
-
- def getStylePropertiesDict(self,style_name):
- res = {}
-
- if self.style_dict[style_name].hasAttribute("style:parent-style-name"):
- parent = self.style_dict[style_name].getAttribute("style:parent-style-name").encode("latin-1")
- res = self.getStylePropertiesDict(parent)
-
- childs = self.style_dict[style_name].childNodes
- for c in childs:
- if c.nodeType == c.ELEMENT_NODE and c.nodeName == "style:properties":
- for attr in c._attrs.keys():
- res[attr] = c.getAttribute(attr).encode("latin-1")
- return res
-
-class PyOpenOffice(object):
- """This is the main class which provides all functionality."""
- def __init__(self, path='.'):
- self.path = path
-
- def oo_read(self,fname):
- z = zipfile.ZipFile(fname,"r")
- content = z.read('content.xml')
- style = z.read('styles.xml')
- all = z.namelist()
- for a in all:
- if a[:9]=='Pictures/' and len(a)>10:
- pic_content = z.read(a)
- f=open(os.path.join(self.path, os.path.basename(a)),"wb")
- f.write(pic_content)
- f.close()
- z.close()
- return content,style
-
- def oo_replace(self,content):
- regex = [
- (r"]*/>", ""),
- #(r"(.*?)", "$1"),
- #(r"(.*?)", "$1"),
- (r"(.*?)]*/>", "$2 "),
- ]
- for key,val in regex:
- content = re.sub(key, val, content)
- return content
-
- def unpackNormalize(self,sourcefile):
- c,s = self.oo_read(sourcefile)
- c = self.oo_replace(c)
- dom = DomApi(c,s)
- dom.normalizeStyleProperties()
- dom.transferStylesXml()
- dom.normalizeLength()
- dom.normalizeTableColumns()
- new_c = dom.toxml()
- return new_c
-
-
-if __name__ == "__main__":
- import sys
- import libxslt
- import libxml2
-
- f = sys.argv[1]
- tool = PyOpenOffice(opt.output)
- res = tool.unpackNormalize(f)
- styledoc = libxml2.parseFile('normalized_oo2rml.xsl')
- style = libxslt.parseStylesheetDoc(styledoc)
- doc = libxml2.parseMemory(res,len(res))
- result = style.applyStylesheet(doc, None)
- xml = style.saveResultToString(result)
- print xml
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py
index 585e996bbed..d52e5941c69 100755
--- a/addons/l10n_ch/wizard/bvr_import.py
+++ b/addons/l10n_ch/wizard/bvr_import.py
@@ -39,215 +39,215 @@ from tools.translate import _
ASK_FORM = """
"""
ASK_FIELDS = {
- 'file': {
- 'string': 'BVR file',
- 'type': 'binary',
- 'required': True,
- },
+ 'file': {
+ 'string': 'BVR file',
+ 'type': 'binary',
+ 'required': True,
+ },
}
def _reconstruct_invoice_ref(cursor, user, reference, context):
- ###
- id_invoice = False
- # On fait d'abord une recherche sur toutes les factures
- # we now searhc for company
- user_obj=pooler.get_pool(cursor.dbname).get('res.users')
- user_current=user_obj.browse(cursor, user, user)
-
- ##
-
- cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id))
- result_invoice = cursor.fetchall()
-
- for inv_id,inv_name in result_invoice:
- inv_name = re.sub('[^0-9]', '0', str(inv_name))
- if inv_name == reference:
- id_invoice = inv_id
- break
- if id_invoice:
- cursor.execute('SELECT l.id ' \
- 'FROM account_move_line l, account_invoice i ' \
- 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \
- 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')')
- inv_line = []
- for id_line in cursor.fetchall():
- inv_line.append(id_line[0])
- return inv_line
- else:
- return []
- return True
+ ###
+ id_invoice = False
+ # On fait d'abord une recherche sur toutes les factures
+ # we now searhc for company
+ user_obj=pooler.get_pool(cursor.dbname).get('res.users')
+ user_current=user_obj.browse(cursor, user, user)
+
+ ##
+
+ cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id))
+ result_invoice = cursor.fetchall()
+
+ for inv_id,inv_name in result_invoice:
+ inv_name = re.sub('[^0-9]', '0', str(inv_name))
+ if inv_name == reference:
+ id_invoice = inv_id
+ break
+ if id_invoice:
+ cursor.execute('SELECT l.id ' \
+ 'FROM account_move_line l, account_invoice i ' \
+ 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \
+ 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')')
+ inv_line = []
+ for id_line in cursor.fetchall():
+ inv_line.append(id_line[0])
+ return inv_line
+ else:
+ return []
+ return True
def _import(obj, cursor, user, data, context):
- pool = pooler.get_pool(cursor.dbname)
- statement_line_obj = pool.get('account.bank.statement.line')
- statement_reconcile_obj = pool.get('account.bank.statement.reconcile')
- move_line_obj = pool.get('account.move.line')
- property_obj = pool.get('ir.property')
- model_fields_obj = pool.get('ir.model.fields')
- attachment_obj = pool.get('ir.attachment')
- file = data['form']['file']
- statement_id = data['id']
+ pool = pooler.get_pool(cursor.dbname)
+ statement_line_obj = pool.get('account.bank.statement.line')
+ statement_reconcile_obj = pool.get('account.bank.statement.reconcile')
+ move_line_obj = pool.get('account.move.line')
+ property_obj = pool.get('ir.property')
+ model_fields_obj = pool.get('ir.model.fields')
+ attachment_obj = pool.get('ir.attachment')
+ file = data['form']['file']
+ statement_id = data['id']
- records = []
- total_amount = 0
- total_cost = 0
- find_total = False
+ records = []
+ total_amount = 0
+ total_cost = 0
+ find_total = False
- for lines in base64.decodestring(file).split("\n"):
- # Manage files without carriage return
- while lines:
- (line, lines) = (lines[:128], lines[128:])
- record = {}
+ for lines in base64.decodestring(file).split("\n"):
+ # Manage files without carriage return
+ while lines:
+ (line, lines) = (lines[:128], lines[128:])
+ record = {}
- if line[0:3] in ('999', '995'):
- if find_total:
- raise wizard.except_wizard(_('Error'),
- _('Too much total record found!'))
- find_total = True
- if lines:
- raise wizard.except_wizard(_('Error'),
- _('Record found after total record!'))
- amount = float(line[39:49]) + (float(line[49:51]) / 100)
- cost = float(line[69:76]) + (float(line[76:78]) / 100)
- if line[2] == '5':
- amount *= -1
- cost *= -1
+ if line[0:3] in ('999', '995'):
+ if find_total:
+ raise wizard.except_wizard(_('Error'),
+ _('Too much total record found!'))
+ find_total = True
+ if lines:
+ raise wizard.except_wizard(_('Error'),
+ _('Record found after total record!'))
+ amount = float(line[39:49]) + (float(line[49:51]) / 100)
+ cost = float(line[69:76]) + (float(line[76:78]) / 100)
+ if line[2] == '5':
+ amount *= -1
+ cost *= -1
- if round(amount - total_amount, 2) >= 0.01 \
- or round(cost - total_cost, 2) >= 0.01:
- raise wizard.except_wizard(_('Error'),
- _('Total record different from the computed!'))
- if int(line[51:63]) != len(records):
- raise wizard.except_wizard(_('Error'),
- _('Number record different from the computed!'))
- else:
- record = {
- 'reference': line[12:39],
- 'amount': float(line[39:47]) + (float(line[47:49]) / 100),
- 'date': time.strftime('%Y-%m-%d',
- time.strptime(line[65:71], '%y%m%d')),
- 'cost': float(line[96:98]) + (float(line[98:100]) / 100),
- }
+ if round(amount - total_amount, 2) >= 0.01 \
+ or round(cost - total_cost, 2) >= 0.01:
+ raise wizard.except_wizard(_('Error'),
+ _('Total record different from the computed!'))
+ if int(line[51:63]) != len(records):
+ raise wizard.except_wizard(_('Error'),
+ _('Number record different from the computed!'))
+ else:
+ record = {
+ 'reference': line[12:39],
+ 'amount': float(line[39:47]) + (float(line[47:49]) / 100),
+ 'date': time.strftime('%Y-%m-%d',
+ time.strptime(line[65:71], '%y%m%d')),
+ 'cost': float(line[96:98]) + (float(line[98:100]) / 100),
+ }
- if record['reference'] != mod10r(record['reference'][:-1]):
- raise wizard.except_wizard(_('Error'),
- _('Recursive mod10 is invalid for reference: %s') % \
- record['reference'])
+ if record['reference'] != mod10r(record['reference'][:-1]):
+ raise wizard.except_wizard(_('Error'),
+ _('Recursive mod10 is invalid for reference: %s') % \
+ record['reference'])
- if line[2] == '5':
- record['amount'] *= -1
- record['cost'] *= -1
- total_amount += record['amount']
- total_cost += record['cost']
- records.append(record)
+ if line[2] == '5':
+ record['amount'] *= -1
+ record['cost'] *= -1
+ total_amount += record['amount']
+ total_cost += record['cost']
+ records.append(record)
- model_fields_ids = model_fields_obj.search(cursor, user, [
- ('name', 'in', ['property_account_receivable', 'property_account_payable']),
- ('model', '=', 'res.partner'),
- ], context=context)
- property_ids = property_obj.search(cursor, user, [
- ('fields_id', 'in', model_fields_ids),
- ('res_id', '=', False),
- ], context=context)
+ model_fields_ids = model_fields_obj.search(cursor, user, [
+ ('name', 'in', ['property_account_receivable', 'property_account_payable']),
+ ('model', '=', 'res.partner'),
+ ], context=context)
+ property_ids = property_obj.search(cursor, user, [
+ ('fields_id', 'in', model_fields_ids),
+ ('res_id', '=', False),
+ ], context=context)
- account_receivable = False
- account_payable = False
- for property in property_obj.browse(cursor, user, property_ids, context=context):
- if property.fields_id.name == 'property_account_receivable':
- account_receivable = int(property.value.split(',')[1])
- elif property.fields_id.name == 'property_account_payable':
- account_payable = int(property.value.split(',')[1])
+ account_receivable = False
+ account_payable = False
+ for property in property_obj.browse(cursor, user, property_ids, context=context):
+ if property.fields_id.name == 'property_account_receivable':
+ account_receivable = int(property.value.split(',')[1])
+ elif property.fields_id.name == 'property_account_payable':
+ account_payable = int(property.value.split(',')[1])
- for record in records:
- # Remove the 11 first char because it can be adherent number
- # TODO check if 11 is the right number
- reference = record['reference'][11:-1].lstrip('0')
- values = {
- 'name': 'IN '+ reference,
- 'date': record['date'],
- 'amount': record['amount'],
- 'ref': reference,
- 'type': (record['amount'] >= 0 and 'customer') or 'supplier',
- 'statement_id': statement_id,
- }
- line_ids = move_line_obj.search(cursor, user, [
- ('ref', 'like', reference),
- ('reconcile_id', '=', False),
- ('account_id.type', 'in', ['receivable', 'payable']),
- ], order='date desc', context=context)
- if not line_ids:
- line_ids = _reconstruct_invoice_ref(cursor,user,reference,None)
-
- line2reconcile = False
- partner_id = False
- account_id = False
- for line in move_line_obj.browse(cursor, user, line_ids, context=context):
- if line.partner_id.id:
- partner_id = line.partner_id.id
- if record['amount'] >= 0:
- if round(record['amount'] - line.debit, 2) < 0.01:
- line2reconcile = line.id
- account_id = line.account_id.id
- break
- else:
- if round(line.credit + record['amount'], 2) < 0.01:
- line2reconcile = line.id
- account_id = line.account_id.id
- break
- if not account_id:
- if record['amount'] >= 0:
- account_id = account_receivable
- else:
- account_id = account_payable
- if not account_id :
- raise wizard.except_wizard(_('Error'),
- _('The properties account payable account receivable'))
- values['account_id'] = account_id
- values['partner_id'] = partner_id
+ for record in records:
+ # Remove the 11 first char because it can be adherent number
+ # TODO check if 11 is the right number
+ reference = record['reference'][11:-1].lstrip('0')
+ values = {
+ 'name': 'IN '+ reference,
+ 'date': record['date'],
+ 'amount': record['amount'],
+ 'ref': reference,
+ 'type': (record['amount'] >= 0 and 'customer') or 'supplier',
+ 'statement_id': statement_id,
+ }
+ line_ids = move_line_obj.search(cursor, user, [
+ ('ref', 'like', reference),
+ ('reconcile_id', '=', False),
+ ('account_id.type', 'in', ['receivable', 'payable']),
+ ], order='date desc', context=context)
+ if not line_ids:
+ line_ids = _reconstruct_invoice_ref(cursor,user,reference,None)
+
+ line2reconcile = False
+ partner_id = False
+ account_id = False
+ for line in move_line_obj.browse(cursor, user, line_ids, context=context):
+ if line.partner_id.id:
+ partner_id = line.partner_id.id
+ if record['amount'] >= 0:
+ if round(record['amount'] - line.debit, 2) < 0.01:
+ line2reconcile = line.id
+ account_id = line.account_id.id
+ break
+ else:
+ if round(line.credit + record['amount'], 2) < 0.01:
+ line2reconcile = line.id
+ account_id = line.account_id.id
+ break
+ if not account_id:
+ if record['amount'] >= 0:
+ account_id = account_receivable
+ else:
+ account_id = account_payable
+ if not account_id :
+ raise wizard.except_wizard(_('Error'),
+ _('The properties account payable account receivable'))
+ values['account_id'] = account_id
+ values['partner_id'] = partner_id
- if line2reconcile:
- values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, {
- 'line_ids': [(6, 0, [line2reconcile])],
- }, context=context)
+ if line2reconcile:
+ values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, {
+ 'line_ids': [(6, 0, [line2reconcile])],
+ }, context=context)
- statement_line_obj.create(cursor, user, values, context=context)
- attachment_obj.create(cursor, user, {
- 'name': 'BVR',
- 'datas': file,
- 'datas_fname': 'BVR.txt',
- 'res_model': 'account.bank.statement',
- 'res_id': statement_id,
- }, context=context)
- return {}
+ statement_line_obj.create(cursor, user, values, context=context)
+ attachment_obj.create(cursor, user, {
+ 'name': 'BVR',
+ 'datas': file,
+ 'datas_fname': 'BVR.txt',
+ 'res_model': 'account.bank.statement',
+ 'res_id': statement_id,
+ }, context=context)
+ return {}
class BVRImport(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': ASK_FORM,
- 'fields': ASK_FIELDS,
- 'state': [
- ('end', 'Cancel', 'gtk-cancel'),
- ('import', 'Import', 'gtk-ok', True),
- ],
- },
- },
- 'import': {
- 'actions': [],
- 'result': {
- 'type': 'action',
- 'action': _import,
- 'state': 'end',
- },
- },
- }
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {
+ 'type': 'form',
+ 'arch': ASK_FORM,
+ 'fields': ASK_FIELDS,
+ 'state': [
+ ('end', 'Cancel', 'gtk-cancel'),
+ ('import', 'Import', 'gtk-ok', True),
+ ],
+ },
+ },
+ 'import': {
+ 'actions': [],
+ 'result': {
+ 'type': 'action',
+ 'action': _import,
+ 'state': 'end',
+ },
+ },
+ }
BVRImport('l10n_ch.bvr_import')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/dta_wizard.py b/addons/l10n_ch/wizard/dta_wizard.py
index fe148c0810a..4a0a8582a0a 100755
--- a/addons/l10n_ch/wizard/dta_wizard.py
+++ b/addons/l10n_ch/wizard/dta_wizard.py
@@ -41,558 +41,568 @@ from tools.translate import _
FORM = """
"""
FIELDS = {
- 'dta': {
- 'string': 'DTA File',
- 'type': 'binary',
- 'readonly': True,
- },
+ 'dta': {
+ 'string': 'DTA File',
+ 'type': 'binary',
+ 'readonly': True,
+ },
}
TRANS=[
- (u'é','e'),
- (u'è','e'),
- (u'à','a'),
- (u'ê','e'),
- (u'î','i'),
- (u'ï','i'),
- (u'â','a'),
- (u'ä','a'),
+ (u'é','e'),
+ (u'è','e'),
+ (u'à','a'),
+ (u'ê','e'),
+ (u'î','i'),
+ (u'ï','i'),
+ (u'â','a'),
+ (u'ä','a'),
]
-def tr(s):
- s= s.decode('utf-8')
- for k in TRANS:
- s = s.replace(k[0],k[1])
- try:
- res= s.encode('ascii','replace')
- except:
- res = s
- return res
+def tr(string_in):
+ try:
+ string_in= string_in.decode('utf-8')
+ except:
+ # If exception => then just take the string as is
+ pass
+ for k in TRANS:
+ string_in = string_in.replace(k[0],k[1])
+ try:
+ res= string_in.encode('ascii','replace')
+ except:
+ res = string_in
+ return res
class record:
- def __init__(self, global_context_dict):
- for i in global_context_dict:
- global_context_dict[i] = global_context_dict[i] \
- and tr(global_context_dict[i])
- self.fields = []
- self.global_values = global_context_dict
- self.pre = {
- 'padding': '',
- 'seg_num1': '01',
- 'seg_num2': '02',
- 'seg_num3': '03',
- 'seg_num4': '04',
- 'seg_num5': '05',
- 'flag': '0',
- 'zero5': '00000'
- }
- self.post={'date_value_hdr': '000000', 'type_paiement': '0'}
- self.init_local_context()
+ def __init__(self, global_context_dict):
+ for i in global_context_dict:
+ global_context_dict[i] = global_context_dict[i] \
+ and tr(global_context_dict[i])
+ self.fields = []
+ self.global_values = global_context_dict
+ self.pre = {
+ 'padding': '',
+ 'seg_num1': '01',
+ 'seg_num2': '02',
+ 'seg_num3': '03',
+ 'seg_num4': '04',
+ 'seg_num5': '05',
+ 'flag': '0',
+ 'zero5': '00000'
+ }
+ self.post={'date_value_hdr': '000000', 'type_paiement': '0'}
+ self.init_local_context()
- def init_local_context(self):
- """
- Must instanciate a fields list, field = (name,size)
- and update a local_values dict.
- """
- raise _('not implemented')
+ def init_local_context(self):
+ """
+ Must instanciate a fields list, field = (name,size)
+ and update a local_values dict.
+ """
+ raise _('not implemented')
- def generate(self):
- res=''
- for field in self.fields :
- if self.pre.has_key(field[0]):
- value = self.pre[field[0]]
- elif self.global_values.has_key(field[0]):
- value = self.global_values[field[0]]
- elif self.post.has_key(field[0]):
- value = self.post[field[0]]
- else :
- pass
- #raise Exception(field[0]+' not found !')
- try:
- res = res + c_ljust(value, field[1])
- except :
- pass
- return res
+ def generate(self):
+ res=''
+ for field in self.fields :
+ if self.pre.has_key(field[0]):
+ value = self.pre[field[0]]
+ elif self.global_values.has_key(field[0]):
+ value = self.global_values[field[0]]
+ elif self.post.has_key(field[0]):
+ value = self.post[field[0]]
+ else :
+ pass
+ #raise Exception(field[0]+' not found !')
+ try:
+ res = res + c_ljust(value, field[1])
+ except :
+ pass
+ return res
class record_gt826(record):
- """
- bvr
- """
- def init_local_context(self):
- self.fields=[
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 12),
- ('padding', 14),
- #seg2
- ('seg_num2', 2),
- ('comp_name', 20),
- ('comp_street', 20),
- ('comp_zip', 10),
- ('comp_city', 10),
- ('comp_country', 20),
- ('padding', 46),
- #seg3
- ('seg_num3', 2),
- ('partner_bvr', 12),#numero d'adherent bvr
- ('partner_name', 20),
- ('partner_street', 20),
- ('partner_zip', 10),
- ('partner_city', 10),
- ('partner_country', 20),
- ('reference', 27),#communication structuree
- ('padding', 2),#cle de controle
- ('padding', 5)
- ]
- self.pre.update({
- 'date_value_hdr': self.global_values['date_value'],
- 'date_value': '',
- 'partner_bank_clearing': '',
- 'partner_cpt_benef': '',
- 'genre_trans': '826',
- 'conv_cours': '',
- 'option_id_bank': 'D',
- 'partner_bvr': '/C/'+ self.global_values['partner_bvr'],
- 'ref2': '',
- 'ref3': '',
- 'format': '0',
- })
+ """
+ bvr
+ """
+ def init_local_context(self):
+ self.fields=[
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 12),
+ ('padding', 14),
+ #seg2
+ ('seg_num2', 2),
+ ('comp_name', 20),
+ ('comp_street', 20),
+ ('comp_zip', 10),
+ ('comp_city', 10),
+ ('comp_country', 20),
+ ('padding', 46),
+ #seg3
+ ('seg_num3', 2),
+ ('partner_bvr', 12),#numero d'adherent bvr
+ ('partner_name', 20),
+ ('partner_street', 20),
+ ('partner_zip', 10),
+ ('partner_city', 10),
+ ('partner_country', 20),
+ ('reference', 27),#communication structuree
+ ('padding', 2),#cle de controle
+ ('padding', 5)
+ ]
+ self.pre.update({
+ 'date_value_hdr': self.global_values['date_value'],
+ 'date_value': '',
+ 'partner_bank_clearing': '',
+ 'partner_cpt_benef': '',
+ 'genre_trans': '826',
+ 'conv_cours': '',
+ 'option_id_bank': 'D',
+ 'partner_bvr': '/C/'+ self.global_values['partner_bvr'],
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '0',
+ })
class record_gt827(record):
- """
- interne suisse (bvpost et bvbank)
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 12),
- ('padding', 14),
- #seg2
- ('seg_num2', 2),
- ('comp_name', 20),
- ('comp_street', 20),
- ('comp_zip', 10),
- ('comp_city', 10),
- ('comp_country', 20),
- ('padding', 46),
- #seg3
- ('seg_num3', 2),
- ('partner_bank_number', 30),
- ('partner_name', 24),
- ('partner_street', 24),
- ('partner_zip', 12),
- ('partner_city', 12),
- ('partner_country', 24),
- #seg4
- ('seg_num4', 2),
- ('reference', 112),
- ('padding', 14),
- #seg5
- #('padding',128)
- ]
+ """
+ interne suisse (bvpost et bvbank)
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 12),
+ ('padding', 14),
+ #seg2
+ ('seg_num2', 2),
+ ('comp_name', 20),
+ ('comp_street', 20),
+ ('comp_zip', 10),
+ ('comp_city', 10),
+ ('comp_country', 20),
+ ('padding', 46),
+ #seg3
+ ('seg_num3', 2),
+ ('partner_bank_number', 30),
+ ('partner_name', 24),
+ ('partner_street', 24),
+ ('partner_zip', 12),
+ ('partner_city', 12),
+ ('partner_country', 24),
+ #seg4
+ ('seg_num4', 2),
+ ('reference', 112),
+ ('padding', 14),
+ #seg5
+ #('padding',128)
+ ]
- self.pre.update({
- 'date_value_hdr': self.global_values['date_value'],
- 'date_value': '',
- 'partner_cpt_benef': '',
- 'type_paiement': '0',
- 'genre_trans': '827',
- 'conv_cours': '',
- 'option_id_bank': 'D',
- 'ref2': '',
- 'ref3': '',
- 'format': '0'
- })
+ self.pre.update({
+ 'date_value_hdr': self.global_values['date_value'],
+ 'date_value': '',
+ 'partner_cpt_benef': '',
+ 'type_paiement': '0',
+ 'genre_trans': '827',
+ 'conv_cours': '',
+ 'option_id_bank': 'D',
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '0'
+ })
class record_gt836(record):
- """
- iban
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 15),
- ('padding', 11),
- #seg2
- ('seg_num2', 2),
- ('conv_cours', 12),
- ('comp_name', 35),
- ('comp_street', 35),
- ('comp_country', 3),
- ('comp_zip', 10),
- ('comp_city', 22),
- ('padding', 9),
- #seg3
- ('seg_num3', 2),
- ('option_id_bank', 1),
- ('partner_bank_ident', 70),
- ('partner_bank_iban', 34),
- ('padding', 21),
- #seg4
- ('seg_num4', 2),
- ('partner_name', 35),
- ('partner_street', 35),
- ('partner_country', 3),
- ('partner_zip', 10),
- ('partner_city', 22),
- ('padding', 21),
- #seg5
- ('seg_num5', 2),
- ('option_motif', 1),
- ('reference', 105),
- ('format', 1),
- ('padding', 19)
- ]
- self.pre.update( {
- 'partner_bank_clearing': '',
- 'partner_cpt_benef': '',
- 'type_paiement': '0',
- 'genre_trans': '836',
- 'conv_cours': '',
- 'reference': self.global_values['reference'],
- 'ref2': '',
- 'ref3': '',
- 'format': '2'
- })
- self.post.update({'option_motif': 'U'})
+ """
+ iban
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 15),
+ ('padding', 11),
+ #seg2
+ ('seg_num2', 2),
+ ('conv_cours', 12),
+ ('comp_name', 35),
+ ('comp_street', 35),
+ ('comp_country', 3),
+ ('comp_zip', 10),
+ ('comp_city', 22),
+ ('padding', 9),
+ #seg3
+ ('seg_num3', 2),
+ ('option_id_bank', 1),
+ ('partner_bank_ident', 70),
+ ('partner_bank_iban', 34),
+ ('padding', 21),
+ #seg4
+ ('seg_num4', 2),
+ ('partner_name', 35),
+ ('partner_street', 35),
+ ('partner_country', 3),
+ ('partner_zip', 10),
+ ('partner_city', 22),
+ ('padding', 21),
+ #seg5
+ ('seg_num5', 2),
+ ('option_motif', 1),
+ ('reference', 105),
+ ('format', 1),
+ ('padding', 19)
+ ]
+ self.pre.update( {
+ 'partner_bank_clearing': '',
+ 'partner_cpt_benef': '',
+ 'type_paiement': '0',
+ 'genre_trans': '836',
+ 'conv_cours': '',
+ 'reference': self.global_values['reference'],
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '2'
+ })
+ self.post.update({'option_motif': 'U'})
class record_gt890(record):
- """
- Total
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #total
- ('amount_total', 16),
- ('padding', 59)
- ]
- self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '',
- 'company_bank_clearing': '', 'genre_trans': '890'})
+ """
+ Total
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #total
+ ('amount_total', 16),
+ ('padding', 59)
+ ]
+ self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '',
+ 'company_bank_clearing': '', 'genre_trans': '890'})
def c_ljust(s, size):
- """
- check before calling ljust
- """
- s= s or ''
- if len(s) > size:
- s= s[:size]
- s = s.decode('utf-8').encode('latin1','replace').ljust(size)
- return s
+ """
+ check before calling ljust
+ """
+ s= s or ''
+ if len(s) > size:
+ s= s[:size]
+ s = s.decode('utf-8').encode('latin1','replace').ljust(size)
+ return s
def _create_dta(obj, cr, uid, data, context):
- v={}
- v['uid'] = str(uid)
- v['creation_date']= time.strftime('%y%m%d')
- dta=''
+ v={}
+ v['uid'] = str(uid)
+ v['creation_date']= time.strftime('%y%m%d')
+ dta=''
- pool = pooler.get_pool(cr.dbname)
- payment_obj = pool.get('payment.order')
- attachment_obj = pool.get('ir.attachment')
+ pool = pooler.get_pool(cr.dbname)
+ payment_obj = pool.get('payment.order')
+ attachment_obj = pool.get('ir.attachment')
- payment = payment_obj.browse(cr, uid, data['id'], context=context)
+ payment = payment_obj.browse(cr, uid, data['id'], context=context)
- if not payment.mode or payment.mode.type.code != 'dta':
- raise wizard.except_wizard(_('Error'),
- _('No payment mode or payment type code invalid.'))
- bank = payment.mode.bank_id
- if not bank:
- raise wizard.except_wizard(_('Error'), _('No bank account for the company.'))
+ if not payment.mode or payment.mode.type.code != 'dta':
+ raise wizard.except_wizard(_('Error'),
+ _('No payment mode or payment type code invalid.'))
+ bank = payment.mode.bank_id
+ if not bank:
+ raise wizard.except_wizard(_('Error'), _('No bank account for the company.'))
- v['comp_bank_name']= bank.bank and bank.bank.name or False
- v['comp_bank_clearing'] = bank.bank.clearing
+ v['comp_bank_name']= bank.bank and bank.bank.name or False
+ v['comp_bank_clearing'] = bank.bank.clearing
- if not v['comp_bank_clearing']:
- raise wizard.except_wizard(_('Error'),
- _('You must provide a Clearing Number for your bank account.'))
+ if not v['comp_bank_clearing']:
+ raise wizard.except_wizard(_('Error'),
+ _('You must provide a Clearing Number for your bank account.'))
- user = pool.get('res.users').browse(cr,uid,[uid])[0]
- company= user.company_id
- #XXX dirty code use get_addr
- co_addr= company.partner_id.address[0]
- v['comp_country'] = co_addr.country_id and co_addr.country_id.name or ''
- v['comp_street'] = co_addr.street or ''
- v['comp_zip'] = co_addr.zip
- v['comp_city'] = co_addr.city
- v['comp_name'] = co_addr.name
- v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice
+ user = pool.get('res.users').browse(cr,uid,[uid])[0]
+ company= user.company_id
+ #XXX dirty code use get_addr
+ co_addr= company.partner_id.address[0]
+ v['comp_country'] = co_addr.country_id and co_addr.country_id.name or ''
+ v['comp_street'] = co_addr.street or ''
+ v['comp_zip'] = co_addr.zip
+ v['comp_city'] = co_addr.city
+ v['comp_name'] = co_addr.name
+ v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice
- v['comp_bank_number'] = bank.acc_number or ''
- if bank.iban:
- v['comp_bank_iban'] = bank.iban.replace(' ','') or ''
- else:
- v['comp_bank_iban'] = ''
- if not v['comp_bank_iban']:
- raise wizard.except_wizard(_('Error'),
- _('No IBAN for the company bank account.'))
+ v['comp_bank_number'] = bank.acc_number or ''
+ if bank.iban:
+ v['comp_bank_iban'] = bank.iban.replace(' ','') or ''
+ else:
+ v['comp_bank_iban'] = ''
+ if not v['comp_bank_iban']:
+ raise wizard.except_wizard(_('Error'),
+ _('No IBAN for the company bank account.'))
- dta_line_obj = pool.get('account.dta.line')
- res_partner_bank_obj = pool.get('res.partner.bank')
+ dta_line_obj = pool.get('account.dta.line')
+ res_partner_bank_obj = pool.get('res.partner.bank')
- seq= 1
- amount_tot = 0
- amount_currency_tot = 0
+ seq= 1
+ amount_tot = 0
+ amount_currency_tot = 0
- for pline in payment.line_ids:
- if not pline.bank_id:
- raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \
- 'on line: %s') % pline.name)
- if not pline.bank_id.bank:
- raise wizard.except_wizard(_('Error'), _('No bank defined\n' \
- 'for the bank account: %s\n' \
- 'on the partner: %s\n' \
- 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name))
+ for pline in payment.line_ids:
+ if not pline.bank_id:
+ raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \
+ 'on line: %s') % pline.name)
+ if not pline.bank_id.bank:
+ raise wizard.except_wizard(_('Error'), _('No bank defined\n' \
+ 'for the bank account: %s\n' \
+ 'on the partner: %s\n' \
+ 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name))
- v['sequence'] = str(seq).rjust(5).replace(' ', '0')
- v['amount_to_pay']= str(pline.amount_currency).replace('.', ',')
- v['number'] = pline.name
- v['currency'] = pline.currency.code
+ v['sequence'] = str(seq).rjust(5).replace(' ', '0')
+ v['amount_to_pay']= str(pline.amount_currency).replace('.', ',')
+ v['number'] = pline.name
+ v['currency'] = pline.currency.code
- v['partner_bank_name'] = pline.bank_id.bank.name or False
- v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False
- if not v['partner_bank_name'] :
- raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \
- 'for the bank account: %s\n' \
- 'on the partner: %s\n' \
- 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name))
+ v['partner_bank_name'] = pline.bank_id.bank.name or False
+ v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False
+ if not v['partner_bank_name'] :
+ raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \
+ 'for the bank account: %s\n' \
+ 'on the partner: %s\n' \
+ 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name))
- v['partner_bank_iban']= pline.bank_id.iban or False
- v['partner_bank_number']= pline.bank_id.acc_number \
- and pline.bank_id.acc_number.replace('.','').replace('-','') \
- or False
- v['partner_post_number']= pline.bank_id.post_number \
- and pline.bank_id.post_number.replace('.', '').replace('-', '') \
- or False
- v['partner_bvr'] = pline.bank_id.bvr_number or ''
- if v['partner_bvr']:
- v['partner_bvr'] = v['partner_bvr'].replace('-','')
- if len(v['partner_bvr']) < 9:
- v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \
- (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:]
+ v['partner_bank_iban']= pline.bank_id.iban or False
+ v['partner_bank_number']= pline.bank_id.acc_number \
+ and pline.bank_id.acc_number.replace('.','').replace('-','') \
+ or False
+ v['partner_post_number']= pline.bank_id.post_number \
+ and pline.bank_id.post_number.replace('.', '').replace('-', '') \
+ or False
+ v['partner_bvr'] = pline.bank_id.bvr_number or ''
+ if v['partner_bvr']:
+ v['partner_bvr'] = v['partner_bvr'].replace('-','')
+ if len(v['partner_bvr']) < 9:
+ v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \
+ (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:]
- if pline.bank_id.bank:
- v['partner_bank_city'] = pline.bank_id.bank.city or False
- v['partner_bank_street'] = pline.bank_id.bank.street or ''
- v['partner_bank_zip'] = pline.bank_id.bank.zip or ''
- v['partner_bank_country'] = pline.bank_id.bank.country and \
- pline.bank_id.bank.country.name or ''
+ if pline.bank_id.bank:
+ v['partner_bank_city'] = pline.bank_id.bank.city or False
+ v['partner_bank_street'] = pline.bank_id.bank.street or ''
+ v['partner_bank_zip'] = pline.bank_id.bank.zip or ''
+ v['partner_bank_country'] = pline.bank_id.bank.country and \
+ pline.bank_id.bank.country.name or ''
- v['partner_bank_code'] = pline.bank_id.bank.bic
- v['reference'] = pline.move_line_id.ref
- v['partner_name'] = pline.partner_id and pline.partner_id.name or ''
- if pline.partner_id and pline.partner_id.address \
- and pline.partner_id.address[0]:
- v['partner_street'] = pline.partner_id.address[0].street
- v['partner_city']= pline.partner_id.address[0].city
- v['partner_zip']= pline.partner_id.address[0].zip
- # If iban => country=country code for space reason
- elec_pay = pline.bank_id.state #Bank type
- if elec_pay == 'iban':
- v['partner_country']= pline.partner_id.address[0].country_id \
- and pline.partner_id.address[0].country_id.code+'-' \
- or ''
- else:
- v['partner_country']= pline.partner_id.address[0].country_id \
- and pline.partner_id.address[0].country_id.name \
- or ''
- else:
- v['partner_street'] =''
- v['partner_city']= ''
- v['partner_zip']= ''
- v['partner_country']= ''
- raise wizard.except_wizard(_('Error'), _('No address defined \n' \
- 'for the partner: %s\n' \
- 'on line: %s') % (pline.partner_id.name, pline.name))
+ v['partner_bank_code'] = pline.bank_id.bank.bic
+ v['reference'] = pline.move_line_id.ref
+ # Add support for owner of the account if exists..
+ if pline.bank_id.owner_name:
+ v['partner_name'] = pline.bank_id.owner_name
+ else:
+ v['partner_name'] = pline.partner_id and pline.partner_id.name or ''
+
+ if pline.partner_id and pline.partner_id.address \
+ and pline.partner_id.address[0]:
+ v['partner_street'] = pline.partner_id.address[0].street
+ v['partner_city']= pline.partner_id.address[0].city
+ v['partner_zip']= pline.partner_id.address[0].zip
+ # If iban => country=country code for space reason
+ elec_pay = pline.bank_id.state #Bank type
+ if elec_pay == 'iban':
+ v['partner_country']= pline.partner_id.address[0].country_id \
+ and pline.partner_id.address[0].country_id.code+'-' \
+ or ''
+ else:
+ v['partner_country']= pline.partner_id.address[0].country_id \
+ and pline.partner_id.address[0].country_id.name \
+ or ''
+ else:
+ v['partner_street'] =''
+ v['partner_city']= ''
+ v['partner_zip']= ''
+ v['partner_country']= ''
+ raise wizard.except_wizard('Error', 'No address defined \n' \
+ 'for the partner: ' + pline.partner_id.name + '\n' \
+ 'on line: ' + pline.name)
- if pline.order_id.date_planned :
- date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d')
- elif pline.date :
- date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d')
- else :
- date_value = mx.DateTime.now()
- v['date_value'] = date_value.strftime("%y%m%d")
+ if pline.order_id.date_planned :
+ date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d')
+ elif pline.date :
+ date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d')
+ else :
+ date_value = mx.DateTime.now()
+ v['date_value'] = date_value.strftime("%y%m%d")
- # si compte iban -> iban (836)
- # si payment structure -> bvr (826)
- # si non -> (827)
+ # si compte iban -> iban (836)
+ # si payment structure -> bvr (826)
+ # si non -> (827)
- if elec_pay == 'dta_iban':
- # If iban => country=country code for space reason
- v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or ''
- record_type = record_gt836
- if not v['partner_bank_iban']:
- raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \
- 'for the bank account: %s\n' + \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+ if elec_pay == 'dta_iban':
+ # If iban => country=country code for space reason
+ v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or ''
+ record_type = record_gt836
+ if not v['partner_bank_iban']:
+ raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \
+ 'for the bank account: %s\n' + \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
- if v['partner_bank_code'] : # bank code is swift (BIC address)
- v['option_id_bank']= 'A'
- v['partner_bank_ident']= v['partner_bank_code']
- elif v['partner_bank_city']:
+ if v['partner_bank_code'] : # bank code is swift (BIC address)
+ v['option_id_bank']= 'A'
+ v['partner_bank_ident']= v['partner_bank_code']
+ elif v['partner_bank_city']:
- v['option_id_bank']= 'D'
- v['partner_bank_ident']= v['partner_bank_name'] \
- + ' ' + v['partner_bank_street'] \
- + ' ' + v['partner_bank_zip'] \
- + ' ' + v['partner_bank_city'] \
- + ' ' + v['partner_bank_country']
- else:
- raise wizard.except_wizard(_('Error'), _('You must provide the bank city '
- 'or the bic code for the partner bank: \n %d\n' + \
- 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name))
+ v['option_id_bank']= 'D'
+ v['partner_bank_ident']= v['partner_bank_name'] \
+ + ' ' + v['partner_bank_street'] \
+ + ' ' + v['partner_bank_zip'] \
+ + ' ' + v['partner_bank_city'] \
+ + ' ' + v['partner_bank_country']
+ else:
+ raise wizard.except_wizard(_('Error'), _('You must provide the bank city '
+ 'or the bic code for the partner bank: \n %d\n' + \
+ 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name))
- elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost':
- from tools import mod10r
- if v['reference']:
- v['reference'] = v['reference'].replace(' ',
- '').rjust(27).replace(' ', '0')
- if not v['reference'] \
- or mod10r(v['reference'][:-1]) != v['reference']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a valid BVR reference number \n' \
- 'for the line: %s') % pline.name)
- if not v['partner_bvr']:
- raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n'
- 'for the bank account: %s' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name))
- record_type = record_gt826
+ elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost':
+ from tools import mod10r
+ if v['reference']:
+ v['reference'] = v['reference'].replace(' ',
+ '').rjust(27).replace(' ', '0')
+ if not v['reference'] \
+ or (mod10r(v['reference'][:-1]) != v['reference'] and \
+ not len(v['reference']) == 15):
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a valid BVR reference number \n' \
+ 'for the line: %s') % pline.name)
+ if not v['partner_bvr']:
+ raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n'
+ 'for the bank account: %s' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name))
+ record_type = record_gt826
- elif elec_pay == 'bvbank':
- if not v['partner_bank_number'] :
- if v['partner_bank_iban'] :
- v['partner_bank_number']= v['partner_bank_iban']
- else:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a bank number \n' \
- 'for the partner bank: %s\n' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
- if not v['partner_bank_clearing']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a Clearing Number\n' \
- 'for the partner bank: %s\n' \
- 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
- v['partner_bank_number'] = '/C/'+v['partner_bank_number']
- record_type = record_gt827
- elif elec_pay == 'bvpost':
- if not v['partner_post_number']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a post number \n' \
- 'for the partner bank: %s\n' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name))
- v['partner_bank_clearing']= ''
- v['partner_bank_number'] = '/C/'+v['partner_post_number']
- record_type = record_gt827
- else:
- raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \
+ elif elec_pay == 'bvbank':
+ if not v['partner_bank_number'] :
+ if v['partner_bank_iban'] :
+ v['partner_bank_number']= v['partner_bank_iban']
+ else:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a bank number \n' \
+ 'for the partner bank: %s\n' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+ if not v['partner_bank_clearing']:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a Clearing Number\n' \
+ 'for the partner bank: %s\n' \
+ 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+ v['partner_bank_number'] = '/C/'+v['partner_bank_number']
+ record_type = record_gt827
+ elif elec_pay == 'bvpost':
+ if not v['partner_post_number']:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a post number \n' \
+ 'for the partner bank: %s\n' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name))
+ v['partner_bank_clearing']= ''
+ v['partner_bank_number'] = '/C/'+v['partner_post_number']
+ record_type = record_gt827
+ else:
+ raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \
% (elec_pay, res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1],))
- dta_line = record_type(v).generate()
+ dta_line = record_type(v).generate()
- dta = dta + dta_line
- amount_tot += pline.amount
- amount_currency_tot += pline.amount_currency
- seq += 1
+ dta = dta + dta_line
+ amount_tot += pline.amount
+ amount_currency_tot += pline.amount_currency
+ seq += 1
- # segment total
- v['amount_total'] = str(amount_currency_tot).replace('.',',')
- v['sequence'] = str(seq).rjust(5).replace(' ','0')
- if dta :
- dta = dta + record_gt890(v).generate()
+ # segment total
+ v['amount_total'] = str(amount_currency_tot).replace('.',',')
+ v['sequence'] = str(seq).rjust(5).replace(' ','0')
+ if dta :
+ dta = dta + record_gt890(v).generate()
- dta_data= base64.encodestring(dta)
- payment_obj.set_done(cr, uid, data['id'], context)
- attachment_obj.create(cr, uid, {
- 'name': 'DTA',
- 'datas': dta_data,
- 'datas_fname': 'DTA.txt',
- 'res_model': 'payment.order',
- 'res_id': data['id'],
- }, context=context)
- return {'dta': dta_data}
+ dta_data= base64.encodestring(dta)
+ payment_obj.set_done(cr, uid, data['id'], context)
+ attachment_obj.create(cr, uid, {
+ 'name': 'DTA',
+ 'datas': dta_data,
+ 'datas_fname': 'DTA.txt',
+ 'res_model': 'payment.order',
+ 'res_id': data['id'],
+ }, context=context)
+ return {'dta': dta_data}
class wizard_dta_create(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_create_dta],
- 'result' : {'type' : 'form',
- 'arch' : FORM,
- 'fields' : FIELDS,
- 'state' : [('end', 'OK', 'gtk-ok', True)]
- }
- },
- }
+ states = {
+ 'init' : {
+ 'actions' : [_create_dta],
+ 'result' : {'type' : 'form',
+ 'arch' : FORM,
+ 'fields' : FIELDS,
+ 'state' : [('end', 'OK', 'gtk-ok', True)]
+ }
+ },
+ }
wizard_dta_create('account.dta_create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_fr/report/base_report.py b/addons/l10n_fr/report/base_report.py
index 488f36304c5..52eb99154a6 100644
--- a/addons/l10n_fr/report/base_report.py
+++ b/addons/l10n_fr/report/base_report.py
@@ -31,7 +31,7 @@ from report import report_sxw
class base_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(base_report, self).__init__(cr, uid, name, context)
+ super(base_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'_load': self._load,
diff --git a/addons/membership/membership.py b/addons/membership/membership.py
index a0d45169278..4b10f03ccab 100644
--- a/addons/membership/membership.py
+++ b/addons/membership/membership.py
@@ -267,7 +267,7 @@ class Partner(osv.osv):
s = 3
if s==4:
for mline in partner_data.member_lines:
- if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and mline.account_invoice_line.invoice_id.state == 'paid':
+ if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid':
s = 5
else:
s = 6
diff --git a/addons/membership/membership_demo.xml b/addons/membership/membership_demo.xml
index 35b04539ce3..495050398d1 100644
--- a/addons/membership/membership_demo.xml
+++ b/addons/membership/membership_demo.xml
@@ -5,8 +5,8 @@
True
- 2008-01-01
- 2009-06-01
+ 2009-01-01
+ 2010-06-01
Membership Product - 1
80
@@ -14,8 +14,8 @@
True
- 2008-01-01
- 2009-08-01
+ 2009-01-01
+ 2010-08-01
Membership Product - 2
80
diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml
index d30276dae95..b126dbd537e 100644
--- a/addons/membership/membership_view.xml
+++ b/addons/membership/membership_view.xml
@@ -51,10 +51,10 @@
-
+
-
-
+
+
diff --git a/addons/membership/wizard/invoice_membership.py b/addons/membership/wizard/invoice_membership.py
index 8eac255c610..5b5e3c44934 100644
--- a/addons/membership/wizard/invoice_membership.py
+++ b/addons/membership/wizard/invoice_membership.py
@@ -80,9 +80,9 @@ def _invoice_membership(self, cr, uid, data, context):
invoice_obj.write(cr, uid, invoice_id, {'invoice_line':[(6,0,[invoice_line_id])]})
invoice_list.append(invoice_id)
if line_value['invoice_line_tax_id']:
- invoice_obj.write(cr, uid, [invoice_id], {'tax_line':tax_tab})
- tax_value = invoice_tax_obj.compute(cr, uid, invoice_id).values()[0]
- invoice_tax_obj.create(cr, uid, tax_value)
+ tax_value = invoice_tax_obj.compute(cr, uid, invoice_id).values()
+ for tax in tax_value:
+ invoice_tax_obj.create(cr, uid, tax, context=context)
value = {
'domain': [
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index caef74d4540..e87962e9ab6 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -129,7 +129,7 @@ class mrp_routing_workcenter(osv.osv):
'cycle_nbr': fields.float('Number of Cycle', required=True,
help="A cycle is defined in the workcenter definition."),
'hour_nbr': fields.float('Number of Hours', required=True),
- 'routing_id': fields.many2one('mrp.routing', 'Parent Routing', select=True),
+ 'routing_id': fields.many2one('mrp.routing', 'Parent Routing', select=True, ondelete='cascade'),
'note': fields.text('Description')
}
_defaults = {
@@ -362,6 +362,8 @@ class mrp_production(osv.osv):
parent_move_line=get_parent_move(production['move_prod_id'][0])
if parent_move_line:
move = move_obj.browse(cr,uid,parent_move_line)
+ #TODO: fix me sale module can not be used here,
+ #as may be mrp can be installed without sale module
if field_name=='name':
res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.name or False
if field_name=='client_order_ref':
@@ -976,6 +978,8 @@ class mrp_procurement(osv.osv):
def action_confirm(self, cr, uid, ids, context={}):
for procurement in self.browse(cr, uid, ids):
+ if procurement.product_qty <= 0.00:
+ raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity of Procurement Order(s), it should not be less than 1!'))
if procurement.product_id.type in ('product', 'consu'):
if not procurement.move_id:
source = procurement.location_id.id
@@ -1074,11 +1078,13 @@ class mrp_procurement(osv.osv):
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
newdate = newdate - procurement.product_id.seller_ids[0].delay
- context.update({'lang':partner.lang})
+ #Passing partner_id to context for purchase order line integrity of Line name
+ context.update({'lang':partner.lang, 'partner_id':partner_id})
+
product=self.pool.get('product.product').browse(cr,uid,procurement.product_id.id,context=context)
line = {
- 'name': product.name,
+ 'name': product.partner_ref,
'product_qty': qty,
'product_id': procurement.product_id.id,
'product_uom': uom_id,
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 83a1b4423a8..0d6a39aa899 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -698,9 +698,8 @@
-
+
-
diff --git a/addons/mrp/mrp_wizard.xml b/addons/mrp/mrp_wizard.xml
index 94d7f663e01..d88ea321ac9 100644
--- a/addons/mrp/mrp_wizard.xml
+++ b/addons/mrp/mrp_wizard.xml
@@ -27,6 +27,13 @@
name="product.product.procurement"
keyword="client_action_multi"
id="product_procurement_wizard"/>
+
+
diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py
index 5fc82b9f7f0..02526d88a64 100644
--- a/addons/mrp/report/order.py
+++ b/addons/mrp/report/order.py
@@ -27,7 +27,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py
index 232b4f9f00b..1fcb7406959 100644
--- a/addons/mrp/wizard/__init__.py
+++ b/addons/mrp/wizard/__init__.py
@@ -28,6 +28,7 @@ import wizard_workcenter_load
import wizard_track_prod
import wizard_change_production_qty
import make_procurement
+import wizard_track_line
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mrp/wizard/wizard_track_line.py b/addons/mrp/wizard/wizard_track_line.py
new file mode 100644
index 00000000000..0866212549a
--- /dev/null
+++ b/addons/mrp/wizard/wizard_track_line.py
@@ -0,0 +1,138 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import pooler
+
+import time
+from osv import osv
+from tools.translate import _
+
+track_form = '''
+
+'''
+fields = {
+ 'tracking_prefix': {
+ 'string': 'Tracking prefix',
+ 'type': 'char',
+ 'size': 64,
+ },
+ 'quantity': {
+ 'string': 'Quantity per lot',
+ 'type': 'float',
+ 'default': 1,
+ }
+}
+
+def _check_picking(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ move_obj = pool.get('stock.move').browse(cr, uid, data['id'])
+ if not move_obj.picking_id:
+ raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.'))
+ return data['form']
+
+def _track_lines(self, cr, uid, data, context):
+ move_id = data['id']
+
+ pool = pooler.get_pool(cr.dbname)
+ prodlot_obj = pool.get('stock.production.lot')
+ move_obj = pool.get('stock.move')
+ production_obj = pool.get('mrp.production')
+ ir_sequence_obj = pool.get('ir.sequence')
+
+ sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
+ if not sequence:
+ raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
+ if data['form']['tracking_prefix']:
+ sequence=data['form']['tracking_prefix']+'/'+(sequence or '')
+
+ move = move_obj.browse(cr, uid, [move_id])[0]
+ quantity=data['form']['quantity']
+ if quantity <= 0 or move.product_qty == 0:
+ return {}
+ uos_qty=quantity/move.product_qty*move.product_uos_qty
+
+ quantity_rest = move.product_qty%quantity
+ uos_qty_rest = quantity_rest/move.product_qty*move.product_uos_qty
+
+ update_val = {
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
+ }
+ new_move = []
+ production_ids = []
+ for idx in range(int(move.product_qty//quantity)):
+ if idx:
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+ new_move.append(current_move)
+ else:
+ current_move = move.id
+ new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
+ update_val['prodlot_id'] = new_prodlot
+ move_obj.write(cr, uid, [current_move], update_val)
+ production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
+
+ if quantity_rest > 0:
+ idx = int(move.product_qty//quantity)
+ update_val['product_qty']=quantity_rest
+ update_val['product_uos_qty']=uos_qty_rest
+ if idx:
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
+ new_move.append(current_move)
+ else:
+ current_move = move.id
+ new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
+ update_val['prodlot_id'] = new_prodlot
+ move_obj.write(cr, uid, [current_move], update_val)
+
+ products = production_obj.read(cr, uid, production_ids, ['move_lines'])
+ for p in products:
+ for new in new_move:
+ if new not in p['move_lines']:
+ p['move_lines'].append(new)
+ production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
+
+ return {}
+
+class wizard_track_move(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [_check_picking],
+ 'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
+ },
+ 'track': {
+ 'actions': [_track_lines],
+ 'result': {'type':'state', 'state':'end'}
+ }
+ }
+
+wizard_track_move('mrp.stock.move.track')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index 059f6a5a0e1..0f194b4f4da 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -330,8 +330,8 @@ class mrp_operations_operation(osv.osv):
if not i: continue
if code_lst[i-1] not in ('resume','start'):
continue
- a = datetime.datetime.strptime(time_lst[i-1],'%Y:%m:%d %H:%M:%S')
- b = datetime.datetime.strptime(time_lst[i],'%Y:%m:%d %H:%M:%S')
+ a = datetime.datetime.strptime(time_lst[i-1],'%Y-%m-%d %H:%M:%S')
+ b = datetime.datetime.strptime(time_lst[i],'%Y-%m-%d %H:%M:%S')
diff += (b-a).days * 24
diff += (b-a).seconds / (60*60)
return diff
diff --git a/addons/mrp_operations/report/mrp_code_barcode.py b/addons/mrp_operations/report/mrp_code_barcode.py
index a4431e55b57..336a46ba546 100755
--- a/addons/mrp_operations/report/mrp_code_barcode.py
+++ b/addons/mrp_operations/report/mrp_code_barcode.py
@@ -26,7 +26,7 @@ from report import report_sxw
class code_barcode(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(code_barcode, self).__init__(cr, uid, name, context)
+ super(code_barcode, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp_operations/report/mrp_wc_barcode.py b/addons/mrp_operations/report/mrp_wc_barcode.py
index bc4fe4976ee..6725f95a95d 100755
--- a/addons/mrp_operations/report/mrp_wc_barcode.py
+++ b/addons/mrp_operations/report/mrp_wc_barcode.py
@@ -26,7 +26,7 @@ from report import report_sxw
class workcenter_code(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(workcenter_code, self).__init__(cr, uid, name, context)
+ super(workcenter_code, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp_repair/report/order.py b/addons/mrp_repair/report/order.py
index be6897d8c2e..b7f3d0bc19d 100644
--- a/addons/mrp_repair/report/order.py
+++ b/addons/mrp_repair/report/order.py
@@ -27,7 +27,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'total': self.total,
diff --git a/addons/mrp_subproduct/mrp_subproduct.py b/addons/mrp_subproduct/mrp_subproduct.py
index b45d3e6424a..92622845818 100644
--- a/addons/mrp_subproduct/mrp_subproduct.py
+++ b/addons/mrp_subproduct/mrp_subproduct.py
@@ -68,9 +68,9 @@ class mrp_production(osv.osv):
qty2 = production.product_uos and production.product_uos_qty or False
if sub_product.subproduct_type=='variable':
if production.product_qty:
- qty1 *= production.product_qty / (sub_product.product_qty or 1.0)
+ qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
if production.product_uos_qty:
- qty2 *= production.product_uos_qty / (sub_product.product_qty or 1.0)
+ qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
data = {
'name':'PROD:'+production.name,
'date_planned': production.date_planned,
diff --git a/addons/point_of_sale/i18n/ar_AR.po b/addons/point_of_sale/i18n/ar_AR.po
index d4aabea1933..c00dce9730e 100644
--- a/addons/point_of_sale/i18n/ar_AR.po
+++ b/addons/point_of_sale/i18n/ar_AR.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/bg_BG.po b/addons/point_of_sale/i18n/bg_BG.po
index 021e27fce38..e028e7ff44a 100644
--- a/addons/point_of_sale/i18n/bg_BG.po
+++ b/addons/point_of_sale/i18n/bg_BG.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/bs_BS.po b/addons/point_of_sale/i18n/bs_BS.po
index 3b304237ebd..dcd9d407cee 100644
--- a/addons/point_of_sale/i18n/bs_BS.po
+++ b/addons/point_of_sale/i18n/bs_BS.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/ca_ES.po b/addons/point_of_sale/i18n/ca_ES.po
index 3c4574a2cde..843a4c94b64 100644
--- a/addons/point_of_sale/i18n/ca_ES.po
+++ b/addons/point_of_sale/i18n/ca_ES.po
@@ -138,10 +138,7 @@ msgstr "Subtotal"
msgid "Partner Ref."
msgstr "Ref. empresa"
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/cs_CZ.po b/addons/point_of_sale/i18n/cs_CZ.po
index c6a6ef89ffa..8061b6481cd 100644
--- a/addons/point_of_sale/i18n/cs_CZ.po
+++ b/addons/point_of_sale/i18n/cs_CZ.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/de_DE.po b/addons/point_of_sale/i18n/de_DE.po
index 77e5b721824..5ce4cb762d5 100644
--- a/addons/point_of_sale/i18n/de_DE.po
+++ b/addons/point_of_sale/i18n/de_DE.po
@@ -138,10 +138,7 @@ msgstr "Zwischensumme"
msgid "Partner Ref."
msgstr "Partner Ref."
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/es_AR.po b/addons/point_of_sale/i18n/es_AR.po
index b20b9c70624..29d4906eee4 100644
--- a/addons/point_of_sale/i18n/es_AR.po
+++ b/addons/point_of_sale/i18n/es_AR.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/es_ES.po b/addons/point_of_sale/i18n/es_ES.po
index 1d440a94df7..aabfe8fb361 100644
--- a/addons/point_of_sale/i18n/es_ES.po
+++ b/addons/point_of_sale/i18n/es_ES.po
@@ -138,10 +138,7 @@ msgstr "Subtotal"
msgid "Partner Ref."
msgstr "Ref. empresa"
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/et_EE.po b/addons/point_of_sale/i18n/et_EE.po
index 7218fdf7c37..9703bffb589 100644
--- a/addons/point_of_sale/i18n/et_EE.po
+++ b/addons/point_of_sale/i18n/et_EE.po
@@ -138,10 +138,7 @@ msgstr "Vahesumma"
msgid "Partner Ref."
msgstr "Partneri viide."
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/fi_FI.po b/addons/point_of_sale/i18n/fi_FI.po
index 840842e2db4..46936b49a14 100644
--- a/addons/point_of_sale/i18n/fi_FI.po
+++ b/addons/point_of_sale/i18n/fi_FI.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/fr_FR.po b/addons/point_of_sale/i18n/fr_FR.po
index 19ba59e12c7..28e3ff23639 100644
--- a/addons/point_of_sale/i18n/fr_FR.po
+++ b/addons/point_of_sale/i18n/fr_FR.po
@@ -138,10 +138,7 @@ msgstr "Sous-total"
msgid "Partner Ref."
msgstr "Réf. Partenaire"
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/hr_HR.po b/addons/point_of_sale/i18n/hr_HR.po
index b41ad69899d..5cec28b9606 100644
--- a/addons/point_of_sale/i18n/hr_HR.po
+++ b/addons/point_of_sale/i18n/hr_HR.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/hu_HU.po b/addons/point_of_sale/i18n/hu_HU.po
index ba904ddc5f6..515a72ebae2 100644
--- a/addons/point_of_sale/i18n/hu_HU.po
+++ b/addons/point_of_sale/i18n/hu_HU.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/id_ID.po b/addons/point_of_sale/i18n/id_ID.po
index 44e011caeda..02edbd08ab8 100644
--- a/addons/point_of_sale/i18n/id_ID.po
+++ b/addons/point_of_sale/i18n/id_ID.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/it_IT.po b/addons/point_of_sale/i18n/it_IT.po
index 2f939669bc0..8058190eaa2 100644
--- a/addons/point_of_sale/i18n/it_IT.po
+++ b/addons/point_of_sale/i18n/it_IT.po
@@ -138,10 +138,7 @@ msgstr "Subtotale"
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/lt_LT.po b/addons/point_of_sale/i18n/lt_LT.po
index 40da4a0db4e..c83387824e3 100644
--- a/addons/point_of_sale/i18n/lt_LT.po
+++ b/addons/point_of_sale/i18n/lt_LT.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/nl_BE.po b/addons/point_of_sale/i18n/nl_BE.po
index 74aab5605cb..1aa3dd2c3be 100644
--- a/addons/point_of_sale/i18n/nl_BE.po
+++ b/addons/point_of_sale/i18n/nl_BE.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/nl_NL.po b/addons/point_of_sale/i18n/nl_NL.po
index 7d7f406efba..b1726218e2b 100644
--- a/addons/point_of_sale/i18n/nl_NL.po
+++ b/addons/point_of_sale/i18n/nl_NL.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/pl_PL.po b/addons/point_of_sale/i18n/pl_PL.po
index 92f1c018364..b0df6ae2943 100644
--- a/addons/point_of_sale/i18n/pl_PL.po
+++ b/addons/point_of_sale/i18n/pl_PL.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot
index 36fc6d1f6ce..dc642bc5183 100644
--- a/addons/point_of_sale/i18n/point_of_sale.pot
+++ b/addons/point_of_sale/i18n/point_of_sale.pot
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/pt_BR.po b/addons/point_of_sale/i18n/pt_BR.po
index 67056cdc629..a3c93c9e68d 100644
--- a/addons/point_of_sale/i18n/pt_BR.po
+++ b/addons/point_of_sale/i18n/pt_BR.po
@@ -138,10 +138,7 @@ msgstr "Subtotal"
msgid "Partner Ref."
msgstr "Código parceiro"
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/pt_PT.po b/addons/point_of_sale/i18n/pt_PT.po
index 0eb9392fa44..3f3033b06b7 100644
--- a/addons/point_of_sale/i18n/pt_PT.po
+++ b/addons/point_of_sale/i18n/pt_PT.po
@@ -138,10 +138,7 @@ msgstr "Sub-total"
msgid "Partner Ref."
msgstr "Ref. do Parceiro"
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/ro_RO.po b/addons/point_of_sale/i18n/ro_RO.po
index 4baea1c603f..9017718c238 100644
--- a/addons/point_of_sale/i18n/ro_RO.po
+++ b/addons/point_of_sale/i18n/ro_RO.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/ru_RU.po b/addons/point_of_sale/i18n/ru_RU.po
index aba2fe83477..a940c848e62 100644
--- a/addons/point_of_sale/i18n/ru_RU.po
+++ b/addons/point_of_sale/i18n/ru_RU.po
@@ -138,10 +138,7 @@ msgstr "Подитог"
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/sl_SL.po b/addons/point_of_sale/i18n/sl_SL.po
index fdab9ca8c4a..b6c0430b22b 100644
--- a/addons/point_of_sale/i18n/sl_SL.po
+++ b/addons/point_of_sale/i18n/sl_SL.po
@@ -138,10 +138,7 @@ msgstr "Delna vsota"
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/sq_AL.po b/addons/point_of_sale/i18n/sq_AL.po
index e20e52b162c..8cddc433cfa 100644
--- a/addons/point_of_sale/i18n/sq_AL.po
+++ b/addons/point_of_sale/i18n/sq_AL.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/sv_SE.po b/addons/point_of_sale/i18n/sv_SE.po
index dc9a95215b0..9577daed78c 100644
--- a/addons/point_of_sale/i18n/sv_SE.po
+++ b/addons/point_of_sale/i18n/sv_SE.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/tr_TR.po b/addons/point_of_sale/i18n/tr_TR.po
index dcc67be7072..4ce1c71ebcf 100644
--- a/addons/point_of_sale/i18n/tr_TR.po
+++ b/addons/point_of_sale/i18n/tr_TR.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/uk_UA.po b/addons/point_of_sale/i18n/uk_UA.po
index d26353bf053..df6071bbc13 100644
--- a/addons/point_of_sale/i18n/uk_UA.po
+++ b/addons/point_of_sale/i18n/uk_UA.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/vi_VN.po b/addons/point_of_sale/i18n/vi_VN.po
index 633bccc52cf..8d8267cccf8 100644
--- a/addons/point_of_sale/i18n/vi_VN.po
+++ b/addons/point_of_sale/i18n/vi_VN.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/zh_CN.po b/addons/point_of_sale/i18n/zh_CN.po
index a34ea332aa7..6d4bb1f19fb 100644
--- a/addons/point_of_sale/i18n/zh_CN.po
+++ b/addons/point_of_sale/i18n/zh_CN.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/i18n/zh_TW.po b/addons/point_of_sale/i18n/zh_TW.po
index 02de6f7a851..162b26ddbed 100644
--- a/addons/point_of_sale/i18n/zh_TW.po
+++ b/addons/point_of_sale/i18n/zh_TW.po
@@ -138,10 +138,7 @@ msgstr ""
msgid "Partner Ref."
msgstr ""
-#. module: point_of_sale
-#: rml:pos.receipt:0
-msgid "Tel : + 32 (0) 2 231 04 35"
-msgstr ""
+
#. module: point_of_sale
#: field:pos.order.line,name:0
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index be588a156dd..88466970905 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -339,28 +339,29 @@ class pos_order(osv.osv):
if new:
for line in order.lines:
- prop_ids = self.pool.get("ir.property").search(cr, uid,
- [('name', '=', 'property_stock_customer')])
- val = self.pool.get("ir.property").browse(cr, uid,
- prop_ids[0]).value
- location_id = order.shop_id.warehouse_id.lot_stock_id.id
- stock_dest_id = int(val.split(',')[1])
- if line.qty < 0:
- (location_id, stock_dest_id)= (stock_dest_id, location_id)
+ if line.product_id.type != 'service':
+ prop_ids = self.pool.get("ir.property").search(cr, uid,
+ [('name', '=', 'property_stock_customer')])
+ val = self.pool.get("ir.property").browse(cr, uid,
+ prop_ids[0]).value
+ location_id = order.shop_id.warehouse_id.lot_stock_id.id
+ stock_dest_id = int(val.split(',')[1])
+ if line.qty < 0:
+ (location_id, stock_dest_id)= (stock_dest_id, location_id)
- self.pool.get('stock.move').create(cr, uid, {
- 'name': 'Stock move (POS %d)' % (order.id, ),
- 'product_uom': line.product_id.uom_id.id,
- 'product_uos': line.product_id.uom_id.id,
- 'picking_id': picking_id,
- 'product_id': line.product_id.id,
- 'product_uos_qty': abs(line.qty),
- 'product_qty': abs(line.qty),
- 'tracking_id': False,
- 'state': 'waiting',
- 'location_id': location_id,
- 'location_dest_id': stock_dest_id,
- })
+ self.pool.get('stock.move').create(cr, uid, {
+ 'name': 'Stock move (POS %d)' % (order.id, ),
+ 'product_uom': line.product_id.uom_id.id,
+ 'product_uos': line.product_id.uom_id.id,
+ 'picking_id': picking_id,
+ 'product_id': line.product_id.id,
+ 'product_uos_qty': abs(line.qty),
+ 'product_qty': abs(line.qty),
+ 'tracking_id': False,
+ 'state': 'waiting',
+ 'location_id': location_id,
+ 'location_dest_id': stock_dest_id,
+ })
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking',
diff --git a/addons/point_of_sale/report/pos_details.py b/addons/point_of_sale/report/pos_details.py
index 1e5962c6586..6a6b9420255 100644
--- a/addons/point_of_sale/report/pos_details.py
+++ b/addons/point_of_sale/report/pos_details.py
@@ -112,7 +112,7 @@ class pos_details(report_sxw.rml_parse):
return '%s - %s' % (min_date, max_date)
def __init__(self, cr, uid, name, context):
- super(pos_details, self).__init__(cr, uid, name, context)
+ super(pos_details, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_details_summary.py b/addons/point_of_sale/report/pos_details_summary.py
index 826844effd6..dc625aee62e 100644
--- a/addons/point_of_sale/report/pos_details_summary.py
+++ b/addons/point_of_sale/report/pos_details_summary.py
@@ -109,7 +109,7 @@ class pos_details_summary(report_sxw.rml_parse):
return '%s - %s' % (min_date, max_date)
def __init__(self, cr, uid, name, context):
- super(pos_details_summary, self).__init__(cr, uid, name, context)
+ super(pos_details_summary, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py
index 54423775614..1d2749b46ef 100644
--- a/addons/point_of_sale/report/pos_invoice.py
+++ b/addons/point_of_sale/report/pos_invoice.py
@@ -29,7 +29,7 @@ from tools.translate import _
class pos_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(pos_invoice, self).__init__(cr, uid, name, context)
+ super(pos_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/point_of_sale/report/pos_lines.py b/addons/point_of_sale/report/pos_lines.py
index 1abec66dc80..66f9754f412 100644
--- a/addons/point_of_sale/report/pos_lines.py
+++ b/addons/point_of_sale/report/pos_lines.py
@@ -27,7 +27,7 @@ from report import report_sxw
class pos_lines(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(pos_lines, self).__init__(cr, uid, name, context)
+ super(pos_lines, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_receipt.py b/addons/point_of_sale/report/pos_receipt.py
index 69f4bd706c2..15d8f177582 100644
--- a/addons/point_of_sale/report/pos_receipt.py
+++ b/addons/point_of_sale/report/pos_receipt.py
@@ -29,7 +29,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
partner = user.company_id.partner_id
diff --git a/addons/point_of_sale/report/pos_receipt.rml b/addons/point_of_sale/report/pos_receipt.rml
index 984d47bb61e..6dd8df26924 100644
--- a/addons/point_of_sale/report/pos_receipt.rml
+++ b/addons/point_of_sale/report/pos_receipt.rml
@@ -92,7 +92,7 @@
[[ setLang(o.user_id.context_lang) ]]
[[o.user_id.company_id.name]]
[[ address and address.street ]], [[ address and address.zip ]] [[ address and address.city ]]
- Tel : + 32 (0) 2 231 04 35
+ Tel : [[ address and address.phone ]]
Fax : [[ address and address.fax ]]
E-mail : [[ address and address.email ]]
@@ -158,18 +158,17 @@
-
-
-
- [[ repeatIn(o.payments,'d') ]]
- [[ d.journal_id.name ]]:
-
-
- [[ d.amount ]]
-
-
-
-
+
+
+
+ [[ repeatIn(o.payments,'d') or removeParentNode('blockTable') ]]
+ [[ d.journal_id.name ]]:
+
+
+ [[ d.amount ]]
+
+
+
diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index 3170a7662a1..4c8006d80f3 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -332,6 +332,16 @@ class product_pricelist_item(osv.osv):
'sequence': lambda *a: 5,
'price_discount': lambda *a: 0,
}
+
+ def _check_recursion(self, cr, uid, ids):
+ for obj_list in self.browse(cr, uid, ids):
+ if obj_list.base == -1:
+ main_pricelist = obj_list.price_version_id.pricelist_id.id
+ other_pricelist = obj_list.base_pricelist_id.id
+ if main_pricelist == other_pricelist:
+ return False
+ return True
+
_columns = {
'name': fields.char('Rule Name', size=64, help="Explicit rule name for this pricelist line."),
'price_version_id': fields.many2one('product.pricelist.version', 'Price List Version', required=True, select=True),
@@ -358,6 +368,11 @@ class product_pricelist_item(osv.osv):
'price_max_margin': fields.float('Max. Price Margin',
digits=(16, int(config['price_accuracy']))),
}
+
+ _constraints = [
+ (_check_recursion, _('Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!'), ['base_pricelist_id'])
+ ]
+
def product_id_change(self, cr, uid, ids, product_id, context={}):
if not product_id:
return {}
diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py
index 3e232f7413c..dc3a1c3512c 100644
--- a/addons/product/report/product_pricelist.py
+++ b/addons/product/report/product_pricelist.py
@@ -27,7 +27,7 @@ import pooler
class product_pricelist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(product_pricelist, self).__init__(cr, uid, name, context)
+ super(product_pricelist, self).__init__(cr, uid, name, context=context)
self.pricelist=False
self.quantity=[]
self.localcontext.update({
diff --git a/addons/project/project.py b/addons/project/project.py
index aaf16082792..029931ea6a9 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -306,12 +306,14 @@ class task(osv.osv):
# Override view according to the company definition
#
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
- tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode
+ tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode or False
f = self.pool.get('res.company').fields_get(cr, uid, ['project_time_mode'], context)
- word = dict(f['project_time_mode']['selection'])[tm]
+ word = 'Hours'
+ if tm:
+ word = dict(f['project_time_mode']['selection'])[tm]
res = super(task, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
- if tm=='hours':
+ if (not tm) or (tm=='hours'):
return res
eview = etree.fromstring(res['arch'])
def _check_rec(eview, tm):
diff --git a/addons/project/report/gantt_report.py b/addons/project/report/gantt_report.py
index 62ab354ae42..feece1d2a70 100644
--- a/addons/project/report/gantt_report.py
+++ b/addons/project/report/gantt_report.py
@@ -20,7 +20,6 @@
#
##############################################################################
-from sets import Set
from mx.DateTime import *
import StringIO
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index 71c3542c010..255f83e7021 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -30,18 +30,15 @@ from tools.translate import _
class project_work(osv.osv):
_inherit = "project.task.work"
_description = "Task Work"
- def create(self, cr, uid, vals, *args, **kwargs):
-
- obj = self.pool.get('hr.analytic.timesheet')
- vals_line = {}
- obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id'])
+ def get_user_related_details(self, cr, uid, user_id):
+ res = {}
emp_obj = self.pool.get('hr.employee')
- emp_id = emp_obj.search(cr, uid, [('user_id', '=', vals.get('user_id', uid))])
-
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)])
if not emp_id:
+ user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name']
raise osv.except_osv(_('Bad Configuration !'),
- _('No employee defined for this user. You must create one.'))
+ _('No employee defined for user "%s". You must create one.')% (user_name,))
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0])
if not emp.product_id:
raise osv.except_osv(_('Bad Configuration !'),
@@ -54,9 +51,22 @@ class project_work(osv.osv):
a = emp.product_id.product_tmpl_id.property_account_expense.id
if not a:
a = emp.product_id.categ_id.property_account_expense_categ.id
-
+ if not a:
+ raise osv.except_osv(_('Bad Configuration !'),
+ _('No product and product category property account defined on the related employee.\nFill in the timesheet tab of the employee form.'))
+ res['product_id'] = emp.product_id.id
+ res['journal_id'] = emp.journal_id.id
+ res['general_account_id'] = a
+ return res
+
+ def create(self, cr, uid, vals, *args, **kwargs):
+ obj = self.pool.get('hr.analytic.timesheet')
+ vals_line = {}
+ obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id'])
+ result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
vals_line['user_id'] = vals['user_id']
+ vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
vals_line['unit_amount'] = vals['hours']
acc_id = obj_task.project_id.category_id.id
@@ -64,8 +74,8 @@ class project_work(osv.osv):
res = obj.on_change_account_id(cr, uid, False, acc_id)
if res.get('value'):
vals_line.update(res['value'])
- vals_line['general_account_id'] = a
- vals_line['journal_id'] = emp.journal_id.id
+ vals_line['general_account_id'] = result['general_account_id']
+ vals_line['journal_id'] = result['journal_id']
vals_line['amount'] = 00.0
timeline_id = obj.create(cr, uid, vals_line, {})
@@ -84,9 +94,13 @@ class project_work(osv.osv):
if line_id in list_avail_ids:
obj = self.pool.get('hr.analytic.timesheet')
if 'name' in vals:
- vals_line['name'] = '%s: %s' % (tools.ustr(task.name), tools.ustr(vals['name']) or '/')
+ vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/')
if 'user_id' in vals:
vals_line['user_id'] = vals['user_id']
+ result = self.get_user_related_details(cr, uid, vals['user_id'])
+ vals_line['product_id'] = result['product_id']
+ vals_line['general_account_id'] = result['general_account_id']
+ vals_line['journal_id'] = result['journal_id']
if 'date' in vals:
vals_line['date'] = vals['date'][:10]
if 'hours' in vals:
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 5661deedeee..194c1d8bbcc 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -150,9 +150,9 @@ class purchase_order(osv.osv):
help="Reference of the document that generated this purchase order request."
),
'partner_ref': fields.char('Partner Ref.', size=64),
- 'date_order':fields.date('Date', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="Date on which this document has been created."),
+ 'date_order':fields.date('Date', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="Date on which this document has been created."),
'date_approve':fields.date('Date Approved', readonly=1),
- 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, change_default=True),
+ 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'posted':[('readonly',True)]}),
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', states={'posted':[('readonly',True)]},
@@ -162,10 +162,10 @@ class purchase_order(osv.osv):
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'posted':[('readonly',True)]}),
'location_id': fields.many2one('stock.location', 'Destination', required=True),
- 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
+ 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Confirmed'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Order Status', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
- 'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)]}),
+ 'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}),
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
'notes': fields.text('Notes'),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
@@ -181,15 +181,15 @@ class purchase_order(osv.osv):
"Manual: no invoice will be pre-generated. The accountant will have to encode manually."
),
'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, method=True,store=True, string='Planned Date', type='datetime', help="This is computed as the minimum scheduled date of all purchase order lines' products."),
- 'amount_untaxed': fields.function(_amount_all, method=True, string='Untaxed Amount',
+ 'amount_untaxed': fields.function(_amount_all, method=True, digits=(16, int(config['price_accuracy'])), string='Untaxed Amount',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
- 'amount_tax': fields.function(_amount_all, method=True, string='Taxes',
+ 'amount_tax': fields.function(_amount_all, method=True, digits=(16, int(config['price_accuracy'])), string='Taxes',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
- 'amount_total': fields.function(_amount_all, method=True, string='Total',
+ 'amount_total': fields.function(_amount_all, method=True, digits=(16, int(config['price_accuracy'])), string='Total',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
@@ -442,7 +442,7 @@ class purchase_order_line(osv.osv):
'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'),
'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'),
'price_unit': fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))),
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
+ 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits=(16, int(config['price_accuracy']))),
'notes': fields.text('Notes'),
'order_id': fields.many2one('purchase.order', 'Order Ref', select=True, required=True, ondelete='cascade'),
'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),
@@ -480,12 +480,7 @@ class purchase_order_line(osv.osv):
uom = prod_uom_po
if not date_order:
date_order = time.strftime('%Y-%m-%d')
- price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist],
- product, qty or 1.0, partner_id, {
- 'uom': uom,
- 'date': date_order,
- })[pricelist]
-
+
qty = qty or 1.0
seller_delay = 0
for s in prod.seller_ids:
@@ -495,6 +490,11 @@ class purchase_order_line(osv.osv):
if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal.
qty = temp_qty
+ price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist],
+ product, qty or 1.0, partner_id, {
+ 'uom': uom,
+ 'date': date_order,
+ })[pricelist]
dt = (DateTime.now() + DateTime.RelativeDateTime(days=seller_delay or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
prod_name = prod.partner_ref
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 2d020bd6180..9e3eda61554 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -233,5 +233,13 @@
name="Purchase orders"
res_model="purchase.order"
src_model="res.partner"/>
+
+
+
diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py
index 52aaa1ae865..66ba383141d 100644
--- a/addons/purchase/report/order.py
+++ b/addons/purchase/report/order.py
@@ -27,7 +27,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_line_tax': self._get_line_tax,
diff --git a/addons/purchase/report/request_quotation.py b/addons/purchase/report/request_quotation.py
index 9acf4309264..0e920e2039d 100644
--- a/addons/purchase/report/request_quotation.py
+++ b/addons/purchase/report/request_quotation.py
@@ -27,7 +27,7 @@ import pooler
class request_quotation(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(request_quotation, self).__init__(cr, uid, name, context)
+ super(request_quotation, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'user': self.pool.get('res.users').browse(cr, uid, uid, context)
diff --git a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
index 89d7d188287..b1814455e98 100644
--- a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
+++ b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
@@ -24,6 +24,7 @@ import wizard
import netsvc
import ir
import pooler
+from osv import osv
invoice_form = """
[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]
- [[ picking.address_id and picking.address_id.street or '' ]][[ picking.address_id and picking.address_id.zip or '' ]]
+ [[ picking.address_id and picking.address_id.street or '' ]]
+ [[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '']]
+
@@ -190,7 +192,7 @@
Expected Shipping Date
- weight
+ Weight
diff --git a/addons/stock/report/product_stock.py b/addons/stock/report/product_stock.py
index 3f1b65b21fb..b5ca5aae0ee 100644
--- a/addons/stock/report/product_stock.py
+++ b/addons/stock/report/product_stock.py
@@ -57,6 +57,8 @@ class report_stock(report_int):
dt_to = now
names = dict(pooler.get_pool(cr.dbname).get('product.product').name_get(cr, uid, product_ids))
+ for name in names:
+ names[name] = names[name].encode('utf8')
products = {}
prods = pooler.get_pool(cr.dbname).get('stock.location')._product_all_get(cr, uid, location_id, product_ids)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 1d7b69c6b3a..d3bf98dc03c 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -436,7 +436,7 @@ class stock_picking(osv.osv):
('confirmed', 'Confirmed'),
('assigned', 'Available'),
('done', 'Done'),
- ('cancel', 'Canceled'),
+ ('cancel', 'Cancelled'),
], 'Status', readonly=True, select=True),
'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
method=True, store=True, type='datetime', string='Planned Date', select=1),
@@ -467,7 +467,8 @@ class stock_picking(osv.osv):
if default is None:
default = {}
default = default.copy()
- default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking')
+ if not default.get('name',False):
+ default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking')
return super(stock_picking, self).copy(cr, uid, id, default, context)
def onchange_partner_in(self, cr, uid, context, partner_id=None):
@@ -742,13 +743,18 @@ class stock_picking(osv.osv):
tax_ids = self._get_taxes_invoice(cursor, user, move_line, type)
account_analytic_id = self._get_account_analytic_invoice(cursor,
user, picking, move_line)
+
+ #set UoS if it's a sale and the picking doesn't have one
+ uos_id = move_line.product_uos and move_line.product_uos.id or False
+ if not uos_id and type in ('out_invoice', 'out_refund'):
+ uos_id = move_line.product_uom.id
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner.property_account_position, account_id)
invoice_line_id = invoice_line_obj.create(cursor, user, {
'name': name,
'origin': origin,
'invoice_id': invoice_id,
- 'uos_id': move_line.product_uos.id,
+ 'uos_id': uos_id,
'product_id': move_line.product_id.id,
'account_id': account_id,
'price_unit': price_unit,
@@ -778,6 +784,17 @@ class stock_picking(osv.osv):
if move.state not in ('cancel',):
return False
return True
+
+ def unlink(self, cr, uid, ids, context=None):
+ for pick in self.browse(cr, uid, ids, context=context):
+ if pick.state in ['done','cancel']:
+ raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,))
+ elif pick.state in ['confirmed','assigned']:
+ ids2 = [move.id for move in pick.move_lines]
+ self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
+ else:
+ continue
+ return super(stock_picking, self).unlink(cr, uid, ids, context=context)
stock_picking()
@@ -953,7 +970,7 @@ class stock_move(osv.osv):
'note': fields.text('Notes'),
- 'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Canceled')], 'Status', readonly=True, select=True),
+ 'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Status', readonly=True, select=True),
'price_unit': fields.float('Unit Price',
digits=(16, int(config['price_accuracy']))),
}
@@ -1022,15 +1039,38 @@ class stock_move(osv.osv):
'message': 'You are moving %.2f products but only %.2f available in this lot.' % (product_qty, prodlot.stock_available or 0.0)
}
return {'warning': warning}
-
+
+ def onchange_quantity(self, cr, uid, ids, product_id, product_qty, product_uom, product_uos):
+ result = {
+ 'product_uos_qty': 0.00
+ }
+
+ if (not product_id) or (product_qty <=0.0):
+ return {'value': result}
+
+ product_obj = self.pool.get('product.product')
+ uos_coeff = product_obj.read(cr, uid, product_id, ['uos_coeff'])
+
+ if product_uos and product_uom and (product_uom != product_uos):
+ result['product_uos_qty'] = product_qty * uos_coeff['uos_coeff']
+ else:
+ result['product_uos_qty'] = product_qty
+
+ return {'value': result}
+
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False, loc_dest_id=False):
if not prod_id:
return {}
product = self.pool.get('product.product').browse(cr, uid, [prod_id])[0]
+ uos_id = product.uos_id and product.uos_id.id or False
result = {
- 'name': product.name,
+ 'name': product.partner_ref,
'product_uom': product.uom_id.id,
+ 'product_uos': uos_id,
+ 'product_qty': 1.00,
+ 'product_uos_qty' : self.pool.get('stock.move').onchange_quantity(cr, uid, ids, prod_id, 1.00, product.uom_id.id, uos_id)['value']['product_uos_qty']
}
+
if loc_id:
result['location_id'] = loc_id
if loc_dest_id:
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 6281d2dd1cc..382a8f87bba 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -229,7 +229,7 @@
# Lot composition (history)
#
- stock.move.tree2
+ Stock Moves
stock.move
tree
move_history_ids
@@ -251,7 +251,7 @@
- stock.move.tree2
+ Stock Moves
stock.move
tree
move_history_ids2
@@ -535,9 +535,9 @@
-
+
-
+
@@ -634,9 +634,9 @@
-
+
-
+
@@ -827,9 +827,9 @@
-
+
-
+
@@ -1016,9 +1016,9 @@
-
+
-
+
@@ -1214,7 +1214,7 @@
-
+
@@ -1239,8 +1239,9 @@
-
+
+
diff --git a/addons/stock/wizard/wizard_partial_picking.py b/addons/stock/wizard/wizard_partial_picking.py
index 2fe375c1b4f..38424f52852 100644
--- a/addons/stock/wizard/wizard_partial_picking.py
+++ b/addons/stock/wizard/wizard_partial_picking.py
@@ -27,6 +27,8 @@ import pooler
import wizard
from osv import osv
+import tools
+from tools.translate import _
_moves_arch = UpdateableStr()
_moves_fields = UpdateableDict()
@@ -34,8 +36,11 @@ _moves_fields = UpdateableDict()
_moves_arch_end = '''
'''
-_moves_fields_end = {}
+_moves_fields_end = {
+ 'back_order_notification': {'string':'Back Order' ,'type':'text', 'readonly':True}
+ }
def make_default(val):
def fct(uid, data, state):
@@ -60,7 +65,7 @@ def _get_moves(self, cr, uid, data, context):
_moves_arch_lst.append(' ' % (m.id,))
_moves_fields['move%s' % m.id] = {
- 'string': '%s - %s' % (_to_xml(m.product_id.code or '/'), _to_xml(m.product_id.name)),
+ 'string': _to_xml(m.name),
'type' : 'float', 'required' : True, 'default' : make_default(quantity)}
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
@@ -198,8 +203,15 @@ def _do_split(self, cr, uid, data, context):
else:
pick_obj.action_move(cr, uid, [pick.id])
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
- return {'new_picking':new_picking or False}
+ bo_name = ''
+ if new_picking:
+ bo_name = pick_obj.read(cr, uid, [new_picking], ['name'])[0]['name']
+ return {'new_picking':new_picking or False, 'back_order':bo_name}
+def _get_default(self, cr, uid, data, context):
+ if data['form']['back_order']:
+ data['form']['back_order_notification'] = _('Back Order %s Assigned to this Packing.') % (tools.ustr(data['form']['back_order']),)
+ return data['form']
class partial_picking(wizard.interface):
@@ -215,10 +227,10 @@ class partial_picking(wizard.interface):
},
'split': {
'actions': [ _do_split ],
- 'result': {'type': 'state', 'state': 'end'},
+ 'result': {'type': 'state', 'state': 'end2'},
},
'end2': {
- 'actions': [ ],
+ 'actions': [ _get_default ],
'result': {'type': 'form', 'arch': _moves_arch_end,
'fields': _moves_fields_end,
'state': (
diff --git a/addons/stock/wizard/wizard_return.py b/addons/stock/wizard/wizard_return.py
index 38c58eb03cc..64e0852578e 100644
--- a/addons/stock/wizard/wizard_return.py
+++ b/addons/stock/wizard/wizard_return.py
@@ -47,7 +47,7 @@ def _get_returns(self, cr, uid, data, context):
for m in [line for line in pick.move_lines]:
quantity=m.product_qty
arch_lst.append(' \n ' % (m.id,))
- fields['return%s' % m.id]={'string':m.product_id.name, 'type':'float', 'required':True, 'default':make_default(quantity)}
+ fields['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True, 'default':make_default(quantity)}
res.setdefault('returns', []).append(m.id)
arch_lst.append(' \n ')
if pick.invoice_state=='invoiced':
diff --git a/addons/stock/wizard/wizard_track_line.py b/addons/stock/wizard/wizard_track_line.py
index 1aeeb0ad215..9576a9cb2f0 100644
--- a/addons/stock/wizard/wizard_track_line.py
+++ b/addons/stock/wizard/wizard_track_line.py
@@ -48,13 +48,20 @@ fields = {
}
}
+def _check_picking(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ move_obj = pool.get('stock.move').browse(cr, uid, data['id'])
+ if not move_obj.picking_id:
+ raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.'))
+ return data['form']
+
def _track_lines(self, cr, uid, data, context):
move_id = data['id']
pool = pooler.get_pool(cr.dbname)
prodlot_obj = pool.get('stock.production.lot')
move_obj = pool.get('stock.move')
- production_obj = pool.get('mrp.production')
+# production_obj = pool.get('mrp.production')
ir_sequence_obj = pool.get('ir.sequence')
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
@@ -77,24 +84,26 @@ def _track_lines(self, cr, uid, data, context):
'product_uos_qty': uos_qty,
}
new_move = []
- production_ids = []
+# production_ids = []
for idx in range(int(move.product_qty//quantity)):
if idx:
- current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
new_move.append(current_move)
else:
current_move = move.id
new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
- production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
+# production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
if quantity_rest > 0:
idx = int(move.product_qty//quantity)
update_val['product_qty']=quantity_rest
update_val['product_uos_qty']=uos_qty_rest
if idx:
- current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
new_move.append(current_move)
else:
current_move = move.id
@@ -102,19 +111,19 @@ def _track_lines(self, cr, uid, data, context):
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
- products = production_obj.read(cr, uid, production_ids, ['move_lines'])
- for p in products:
- for new in new_move:
- if new not in p['move_lines']:
- p['move_lines'].append(new)
- production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
+# products = production_obj.read(cr, uid, production_ids, ['move_lines'])
+# for p in products:
+# for new in new_move:
+# if new not in p['move_lines']:
+# p['move_lines'].append(new)
+# production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
return {}
class wizard_track_move(wizard.interface):
states = {
'init': {
- 'actions': [],
+ 'actions': [_check_picking],
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
},
'track': {
diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py
index 7c4c80f03be..f2426fdd16c 100644
--- a/addons/subscription/subscription.py
+++ b/addons/subscription/subscription.py
@@ -40,6 +40,12 @@ class subscription_document(osv.osv):
_defaults = {
'active' : lambda *a: True,
}
+
+ def write(self, cr, uid, ids, vals, context=None):
+ if 'model' in vals:
+ raise osv.except_osv(_('Error !'),_('You cannot modify the Object linked to the Document Type!\nCreate another Document instead !'))
+ return super(subscription_document, self).write(cr, uid, ids, vals, context=context)
+
subscription_document()
class subscription_document_fields(osv.osv):
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index c5ee7106851..6dd8d78f5c7 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -22,6 +22,7 @@
import time
from osv import fields,osv
+from tools.translate import _
WARNING_MESSAGE = [
('no-message','No Message'),
@@ -29,7 +30,7 @@ WARNING_MESSAGE = [
('block','Blocking Message')
]
-WARNING_HELP = 'Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.'
+WARNING_HELP = _('Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.')
class res_partner(osv.osv):
_inherit = 'res.partner'
@@ -64,20 +65,21 @@ class sale_order(osv.osv):
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.sale_warn != 'no-message':
if partner.sale_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.sale_warn_msg)
-
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.sale_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.sale_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.sale_warn_msg
+ 'title': title,
+ 'message': message,
}
- result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
+ result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
- return {'value': result, 'warning':warning}
+ return {'value': result.get('value',{}), 'warning':warning}
sale_order()
@@ -87,17 +89,25 @@ class purchase_order(osv.osv):
if not part:
return {'value':{'partner_address_id': False}}
warning = {}
+ title = False
+ message = False
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.purchase_warn != 'no-message':
if partner.purchase_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.purchase_warn_msg)
-
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.purchase_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.purchase_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.purchase_warn_msg
+ 'title': title,
+ 'message': message
}
- result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)['value']
- return {'value': result, 'warning':warning}
+ result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)
+
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result.get('value',{}), 'warning':warning}
purchase_order()
@@ -116,17 +126,27 @@ class account_invoice(osv.osv):
}
}
warning = {}
+ title = False
+ message = False
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
if partner.invoice_warn != 'no-message':
if partner.invoice_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.invoice_warn_msg)
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.invoice_warn_msg)
+
+ title = _("Warning for %s") % partner.name
+ message = partner.invoice_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.invoice_warn_msg
+ 'title': title,
+ 'message': message
}
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False)['value']
- return {'value': result, 'warning':warning}
+ date_invoice=False, payment_term=False, partner_bank_id=False)
+
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result.get('value',{}), 'warning':warning}
account_invoice()
@@ -138,15 +158,23 @@ class stock_picking(osv.osv):
return {}
partner = self.pool.get('res.partner.address').browse(cr, uid, [partner_id])[0].partner_id
warning = {}
+ title = False
+ message = False
if partner.picking_warn != 'no-message':
if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.picking_warn_msg)
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.picking_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.picking_warn_msg
+ 'title': title,
+ 'message': message
}
result = super(stock_picking, self).onchange_partner_in(cr, uid, context, partner_id)
- return {'value': result, 'warning':warning}
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result.get('value',{}), 'warning':warning}
stock_picking()
@@ -184,8 +212,8 @@ class sale_order_line(osv.osv):
if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block':
- raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.sale_line_warn_msg)
- title = "Warning for " + product_info.name
+ raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.sale_line_warn_msg)
+ title = _("Warning for %s") % product_info.name
message = product_info.sale_line_warn_msg
warning['title'] = title
warning['message'] = message
@@ -193,15 +221,15 @@ class sale_order_line(osv.osv):
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
lang, update_tax, date_order, packaging, fiscal_position, flag)
- if title and message:
- warning['title']=title[0]
- warning['message']=message
+# if title and message:
+# warning['title'] = title
+# warning['message']= message
if result.get('warning',False):
- warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
- return {'value': result['value'], 'warning':warning}
+ return {'value': result.get('value',{}), 'warning':warning}
sale_order_line()
@@ -219,8 +247,8 @@ class purchase_order_line(osv.osv):
if product_info.purchase_line_warn != 'no-message':
if product_info.purchase_line_warn == 'block':
- raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.purchase_line_warn_msg)
- title = "Warning for " + product_info.name
+ raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.purchase_line_warn_msg)
+ title = _("Warning for %s") % product_info.name
message = product_info.purchase_line_warn_msg
warning['title'] = title
warning['message'] = message
@@ -229,10 +257,10 @@ class purchase_order_line(osv.osv):
partner_id, date_order, fiscal_position)
if result.get('warning',False):
- warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
- return {'value': result['value'], 'warning':warning}
+ return {'value': result.get('value',{}), 'warning':warning}
purchase_order_line()