本文整理汇总了Python中tools.translate._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: action_move
def action_move(self, cr, uid, ids, context={}):
for picking in self.browse(cr, uid, ids):
if picking.invoice_state == "2binvoiced":
cr.commit() #ensure that picking has been eventually split
so = picking.sale_id
#eventually block the picking:
so_lines_total_price = 0
for move in picking.move_lines:
so_line = self.pool.get('sale.order.line').browse(cr, uid, move.sale_line_id.id)
sale_shop = so_line.order_id.shop_id
print "so_line.price_subtotal * move.product_qty / so_line.product_uos_qty", so_line.price_subtotal_incl, move.product_qty, so_line.product_uos_qty
if so_line.price_subtotal_incl:
so_lines_total_price += so_line.price_subtotal_incl * move.product_qty / so_line.product_uos_qty
else:
so_lines_total_price += so_line.price_subtotal * move.product_qty / so_line.product_uos_qty
print "so_lines_total_price", so_lines_total_price
if (- so.partner_id.credit) * 1.001 < so_lines_total_price * float(sale_shop.picking_blocking_deposit_percent) / 100.0:
raise osv.except_osv(_('Error !'), _("Not enough deposits amount! Sale Shop is configured to block picking if paid amount is below %s percent, that is %s") % (sale_shop.picking_blocking_deposit_percent, so_lines_total_price * float(sale_shop.picking_blocking_deposit_percent) / 100.0))
#then invoice picking:
data2 ={'form':{'group': 0, 'type':'out_invoice', 'journal_id': sale_shop.picking_invoicing_journal_id.id}, 'ids':[picking.id], 'id': picking.id}
self._create_invoice(cr, uid, data2, {}) #TODO real context
super(stock_picking, self).action_move(cr, uid, ids, context) #actually perform the move
开发者ID:kevin-garnett,项目名称:openerp-from-oneyoung,代码行数:28,代码来源:stock.py
示例2: initialize
def initialize(self):
#login
PortType,sessionid = sugar.login(self.context.get('username',''), self.context.get('password',''), self.context.get('url',''))
if sessionid == '-1':
raise osv.except_osv(_('Error !'), _('Authentication error !\nBad Username or Password or bad SugarSoap Api url !'))
self.context['port'] = PortType
self.context['session_id'] = sessionid
开发者ID:CloudWareChile,项目名称:OpenChile,代码行数:7,代码来源:import_sugarcrm.py
示例3: select_product
def select_product(self, cr, uid, ids, context=None):
"""
To get the product and quantity and add in order .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Return the add product form again for adding more product
"""
if context is None:
context = {}
this = self.browse(cr, uid, ids[0], context=context)
record_id = context and context.get('active_id', False)
assert record_id, _('Active ID is not found')
if record_id:
order_obj = self.pool.get('pos.order')
order_obj.add_product(cr, uid, record_id, this.product_id.id, this.quantity, context=context)
return {
'name': _('Add Product'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.add.product',
'view_id': False,
'target': 'new',
'views': False,
'type': 'ir.actions.act_window',
}
开发者ID:davgit,项目名称:Xero-2,代码行数:27,代码来源:pos_add_product.py
示例4: _repair_action
def _repair_action(self, cr, uid, data, context):
"""
Action that repairs the invoice numbers
"""
logger = netsvc.Logger()
logger.notifyChannel("l10n_es_account_invoice_sequence_fix", netsvc.LOG_DEBUG, "Searching for invoices.")
invoice_facade = pooler.get_pool(cr.dbname).get('account.invoice')
invoice_ids = invoice_facade.search(cr, uid, [('move_id','<>','')], limit=0, order='id', context=context)
if len(invoice_ids) == 0:
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
logger.notifyChannel("l10n_es_account_invoice_sequence_fix", netsvc.LOG_DEBUG, "Repairing %d invoices." % len(invoice_ids))
for invoice in invoice_facade.browse(cr, uid, invoice_ids):
move_id = invoice.move_id or False
if move_id:
cr.execute('UPDATE account_invoice SET invoice_number=%s WHERE id=%s', (move_id.id, invoice.id))
logger.notifyChannel("l10n_es_account_invoice_sequence_fix", netsvc.LOG_DEBUG, "%d invoices repaired." % len(invoice_ids))
vals = {
}
return vals
开发者ID:Mlayns,项目名称:openerp-spain,代码行数:26,代码来源:wizard_invoice_number_repair.py
示例5: account_move_get
def account_move_get(self, cr, uid, voucher_id, context=None):
seq_obj = self.pool.get('ir.sequence')
voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context)
if voucher_brw.number:
name = voucher_brw.number
elif voucher_brw.journal_id.sequence_id:
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id)
else:
raise osv.except_osv(_('Error !'),
_('Please define a sequence on the journal !'))
if not voucher_brw.reference:
ref = name.replace('/','')
else:
ref = voucher_brw.reference
print ' voucher_brw.fecha '+str( voucher_brw.fecha)+' '+str(voucher_brw.date)
move = {
'name': name,
'journal_id': voucher_brw.journal_id.id,
'narration': voucher_brw.narration,
'date': voucher_brw.fecha or voucher_brw.date,
'ref': ref,
'period_id': voucher_brw.period_id and voucher_brw.period_id.id or False
}
return move
开发者ID:Pexego,项目名称:addons-va-ca-ti,代码行数:28,代码来源:facturas.py
示例6: _empty
def _empty(self, cr, uid, context=None):
close = []
up = []
obj_tb = self.pool.get('project.gtd.timebox')
obj_task = self.pool.get('project.task')
if context is None:
context = {}
if not 'active_id' in context:
return {}
ids = obj_tb.search(cr, uid, [], context=context)
if not len(ids):
raise osv.except_osv(_('Error !'), _('No timebox child of this one !'))
tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])])
for task in obj_task.browse(cr, uid, tids, context):
if (task.state in ('cancel','done')) or (task.user_id.id <> uid):
close.append(task.id)
else:
up.append(task.id)
if up:
obj_task.write(cr, uid, up, {'timebox_id':ids[0]})
if close:
obj_task.write(cr, uid, close, {'timebox_id':False})
return {}
开发者ID:CloudWareChile,项目名称:OpenChile,代码行数:25,代码来源:project_gtd_empty.py
示例7: subscribe
def subscribe(self, cr, uid, ids, *args):
"""
Subscribe Rule for auditing changes on object and apply shortcut for logs on that object.
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of Auddittrail Rule’s IDs.
@return: True
"""
obj_action = self.pool.get('ir.actions.act_window')
obj_model = self.pool.get('ir.model.data')
#start Loop
for thisrule in self.browse(cr, uid, ids):
obj = self.pool.get(thisrule.object_id.model)
if not obj:
raise osv.except_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": "[('object_id','=', " + str(thisrule.object_id.id) + "), ('res_id', '=', active_id)]"
}
action_id = obj_action.create(cr, 1, val)
self.write(cr, uid, [thisrule.id], {"state": "subscribed", "action_id": action_id})
keyword = 'client_action_relate'
value = 'ir.actions.act_window,' + str(action_id)
res = obj_model.ir_set(cr, 1, 'action', keyword, 'View_log_' + thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False)
#End Loop
return True
开发者ID:sergiocorato,项目名称:ocb-addons-61,代码行数:32,代码来源:audittrail.py
示例8: _split
def _split(self, cr, uid, id, quantity, context):
"""
Sets the quantity to produce for production with id 'id' to 'quantity' and
creates a new production order with the deference between current amount and
the new quantity.
"""
production = self.browse(cr, uid, id, context)
if production.state != 'confirmed':
# raise osv.except_osv(_('Error !'), _('Production order "%s" is not in "Waiting Goods" state.') % production.name)
pass
if quantity >= production.product_qty:
raise osv.except_osv(_('Error !'), _('Quantity must be greater than production quantity in order "%s" (%s / %s)') % (production.name, quantity, production.product_qty))
# Create new production, but ensure product_lines is kept empty.
new_production_id = self.copy(cr, uid, id, {
'product_lines': [],
'move_prod_id': False,
'product_qty': quantity,
}, context)
self.write(cr, uid, production.id, {
'product_qty': production.product_qty -quantity,
'product_lines': [],
}, context)
self.action_compute(cr, uid, [ new_production_id])
self._change_prod_qty( cr, uid, production.id ,production.product_qty-quantity, context)
workflow = netsvc.LocalService("workflow")
workflow.trg_validate(uid, 'mrp.production', new_production_id, 'button_confirm', cr)
return [id, new_production_id]
开发者ID:cgsoftware,项目名称:mrp_production_split_omaf,代码行数:32,代码来源:mrp.py
示例9: create
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
if not vals['parent_id']:
vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context)
if not vals.get('res_id', False) and context.get('default_res_id', False):
vals['res_id'] = context.get('default_res_id', False)
if not vals.get('res_model', False) and context.get('default_res_model', False):
vals['res_model'] = context.get('default_res_model', False)
if vals.get('res_id', False) and vals.get('res_model', False) \
and not vals.get('partner_id', False):
vals['partner_id'] = self.__get_partner_id(cr, uid, \
vals['res_model'], vals['res_id'], context)
datas = None
if vals.get('link', False) :
import urllib
datas = base64.encodestring(urllib.urlopen(vals['link']).read())
else:
datas = vals.get('datas', False)
if datas:
vals['file_size'] = len(datas)
else:
if vals.get('file_size'):
del vals['file_size']
if not self._check_duplication(cr, uid, vals):
raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
result = super(document_file, self).create(cr, uid, vals, context)
cr.commit() # ?
return result
开发者ID:sgeerish,项目名称:sirr_production,代码行数:32,代码来源:document.py
示例10: view_init
def view_init(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
active_id = context and context.get('active_id', False) or False
if active_id:
order = self.pool.get('pos.order').browse(cr, uid, active_id, context=context)
partner_id = order.partner_id and order.partner_id or False
if not partner_id:
partner_id = order.partner_id or False
''' Check if the partner has other pickings with the same products'''
pos_warn_sale_order = order.pos_warn_sale_order or False
if pos_warn_sale_order and partner_id:
address_ids = [adr.id for adr in partner_id.address]
picking_obj = self.pool.get('stock.picking')
picking_ids = picking_obj.search(cr, uid, [
('state', 'in', ['auto','confirmed','assigned']),
('id', '!=', order.picking_id.id),
('address_id', 'in', address_ids),
])
if picking_ids:
product_ids = [line.product_id.id for line in order.lines]
for picking in picking_obj.browse(cr, uid, picking_ids, context):
for m in picking.move_lines:
if m.product_id.id in product_ids:
product = (m.product_id.name).encode('utf-8')
sale_order_info = (picking.origin and picking.name + '-' + picking.origin or picking.name).encode('utf-8')
raise osv.except_osv(_('Warning! Product already ordered'),
_("Product %s is already ordered in picking %s." \
" If you want to order it again ignoring this picking,"\
" you must uncheck the boolean field"\
" 'Product in sale order warning'.") % (product, sale_order_info))
return True
开发者ID:Arsalan88,项目名称:openerp-extra-6.1,代码行数:35,代码来源:pos_payment.py
示例11: _change_prod_qty
def _change_prod_qty(self, cr, uid, id ,quantity, context):
prod_obj = self.pool.get('mrp.production')
prod = prod_obj.browse(cr, uid, id , context=context)
prod_obj.write(cr, uid, prod.id, {'product_qty' : quantity })
prod_obj.action_compute(cr, uid, [prod.id])
move_lines_obj = self.pool.get('stock.move')
for move in prod.move_lines:
bom_point = prod.bom_id
bom_id = prod.bom_id.id
if not bom_point:
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id)
if not bom_id:
raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product"))
self.write(cr, uid, [prod.id], {'bom_id': bom_id})
bom_point = self.pool.get('mrp.bom').browse(cr, uid, [bom_id])[0]
if not bom_id:
raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product"))
factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor
res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, [])
for r in res[0]:
if r['product_id']== move.product_id.id:
move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']})
product_lines_obj = self.pool.get('mrp.production.product.line')
for m in prod.move_created_ids:
move_lines_obj.write(cr, uid,m.id, {'product_qty' : quantity})
return {}
开发者ID:cgsoftware,项目名称:mrp_production_split_omaf,代码行数:33,代码来源:mrp.py
示例12: create_balance_line
def create_balance_line(self, cr, uid, move, res_user, name, context=None):
move_line_obj = self.pool.get('account.move.line')
amount = self.get_balance_amount(cr, uid, move.id, context=context)
if amount > 0:
account_id = res_user.company_id.expense_currency_exchange_account_id.id
if not account_id:
raise osv.except_osv(_('Error!'), _('The company have not associated a expense account.\n'))
credit = amount
debit = 0.00
else:
account_id = res_user.company_id.income_currency_exchange_account_id.id
if not account_id:
raise osv.except_osv(_('Error!'), _('The company have not associated a income account.\n'))
credit = 0.00
debit = amount * -1
move_line = {
'name': name,
'ref': name,
'debit': debit,
'credit': credit,
'account_id': account_id,
'move_id': move.id,
'period_id': move.period_id.id,
'journal_id': move.journal_id.id,
'partner_id': False,
'currency_id': False,
'amount_currency': 0.00,
'state': 'valid',
'company_id': res_user.company_id.id,
}
new_move_line_id = move_line_obj.create(cr, uid, move_line, context=context)
return new_move_line_id
开发者ID:3dfxsoftware,项目名称:cbss-addons,代码行数:33,代码来源:account_exchange_rates_adjustment.py
示例13: _send_mails
def _send_mails(self, cr, uid, data, context):
import re
p = pooler.get_pool(cr.dbname)
user = p.get('res.users').browse(cr, uid, uid, context)
file_name = user.company_id.name.replace(' ','_')+'_'+_('Sale_Order')
default_smtpserver_id = p.get('email.smtpclient').search(cr, uid, [('users_id','=',uid), ('pstate','=','running')], context=None)
if default_smtpserver_id:
default_smtpserver_id = default_smtpserver_id[0]
else:
raise osv.except_osv(_('Error'),
_('Can\'t send email, please check whether SMTP client has been defined and you have permission to access!'))
attachments = data['form']['attachment_file']
attachments = [attachments] or []
nbr = 0
for email in data['form']['to'].split(','):
state = p.get('email.smtpclient').send_email(cr, uid, default_smtpserver_id, email, data['form']['subject'], data['form']['text'], attachments)
if not state:
raise osv.except_osv(_('Error sending email'), _('Please check the Server Configuration!'))
nbr += 1
return {'email_sent': nbr}
开发者ID:aryaadiputra,项目名称:addons60_ptgbu_2013,代码行数:25,代码来源:wizard_print_journal_entries.py
示例14: product_id_change
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True, date_order=False, packaging=False,
fiscal_position=False, flag=False, context=None):
warning = {}
if not product:
return {'value': {'th_weight' : 0, 'product_packaging': False,
'product_uos_qty': qty}, 'domain': {'product_uom': [],
'product_uos': []}}
product_obj = self.pool.get('product.product')
product_info = product_obj.browse(cr, uid, product)
title = False
message = False
if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block':
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
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, context=context)
if result.get('warning',False):
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.get('value',{}), 'warning':warning}
开发者ID:adrianorissi,项目名称:openobject-addons,代码行数:31,代码来源:warning.py
示例15: validate
def validate(self, cr, uid, ids, context=None):
# Add a validation process that all periods being posted is still open
for _obj in self.browse(cr, uid, ids, context=context):
if _obj.period_id.state in ('done'):
raise osv.except_osv(_('Error!'), _("Move %s is dated in closed period.") % (_obj.name))
return super(account_move, self).validate(cr, uid, ids, context=context)
开发者ID:open-synergy,项目名称:prln-via-custom-addons,代码行数:7,代码来源:account.py
示例16: refund_sheet
def refund_sheet(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
wf_service = netsvc.LocalService("workflow")
for payslip in self.browse(cr, uid, ids, context=context):
id_copy = self.copy(cr, uid, payslip.id, {'credit_note': True, 'name': _('Refund: ')+payslip.name}, context=context)
self.compute_sheet(cr, uid, [id_copy], context=context)
wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'hr_verify_sheet', cr)
wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'process_sheet', cr)
form_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_form')
form_res = form_id and form_id[1] or False
tree_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_tree')
tree_res = tree_id and tree_id[1] or False
return {
'name':_("Refund Payslip"),
'view_mode': 'tree, form',
'view_id': False,
'view_type': 'form',
'res_model': 'hr.payslip',
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'domain': "[('id', 'in', %s)]" % [id_copy],
'views': [(tree_res, 'tree'), (form_res, 'form')],
'context': {}
}
开发者ID:CloudWareChile,项目名称:OpenChile,代码行数:26,代码来源:hr_payroll.py
示例17: create_aeroo_report
def create_aeroo_report(self, cr, uid, ids, data, report_xml, context=None, output='odt'):
""" Returns an aeroo report generated with aeroolib
"""
pool = pooler.get_pool(cr.dbname)
if not context:
context={}
context = context.copy()
if self.name=='report.printscreen.list':
context['model'] = data['model']
context['ids'] = ids
print_id = context.get('print_id', False)
aeroo_print = self.active_prints[print_id] # Aeroo print object
aeroo_print.subreports = []
#self.oo_subreports[print_id] = []
objects = self.getObjects_mod(cr, uid, ids, report_xml.report_type, context) or []
oo_parser = self.parser(cr, uid, self.name2, context=context)
oo_parser.localcontext.update(context)
oo_parser.set_context(objects, data, ids, report_xml.report_type)
self.set_xml_data_fields(objects, oo_parser) # Get/Set XML
oo_parser.localcontext['data'] = data
oo_parser.localcontext['user_lang'] = context.get('lang', False)
if len(objects)>0:
oo_parser.localcontext['o'] = objects[0]
xfunc = ExtraFunctions(cr, uid, report_xml.id, oo_parser.localcontext)
oo_parser.localcontext.update(xfunc.functions)
#company_id = objects and 'company_id' in objects[0]._table._columns.keys() and \
# objects[0].company_id and objects[0].company_id.id or False # for object company usage
company_id = False
style_io=self.get_styles_file(cr, uid, report_xml, company=company_id, context=context)
if report_xml.tml_source in ('file', 'database'):
if not report_xml.report_sxw_content or report_xml.report_sxw_content=='False':
raise osv.except_osv(_('Error!'), _('No template found!'))
file_data = base64.decodestring(report_xml.report_sxw_content)
else:
file_data = self.get_other_template(cr, uid, data, oo_parser)
if not file_data and not report_xml.report_sxw_content:
self.logger("End process %s (%s), elapsed time: %s" % (self.name, self.table, time.time() - aeroo_print.start_time), logging.INFO) # debug mode
return False, output
#elif file_data:
# template_io = StringIO()
# template_io.write(file_data or report_xml.report_sxw_content)
# basic = Template(source=template_io, styles=style_io)
else:
if report_xml.preload_mode == 'preload' and hasattr(self, 'serializer'):
serializer = copy.copy(self.serializer)
serializer.apply_style(style_io)
template_io = serializer.template
else:
template_io = StringIO()
template_io.write(file_data or base64.decodestring(report_xml.report_sxw_content) )
serializer = OOSerializer(template_io, oo_styles=style_io)
try:
basic = Template(source=template_io, serializer=serializer)
except Exception, e:
self._raise_exception(e, print_id)
开发者ID:3dfxsoftware,项目名称:customaddons,代码行数:60,代码来源:report_aeroo.py
示例18: default_get
def default_get(self, cr, uid, fields, context=None):
"""
This function gets default values
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
@return : default values of fields.
"""
if context is None:
context = {}
meeting_pool = self.pool.get('project.scrum.meeting')
record_ids = context and context.get('active_ids', []) or []
res = super(project_scrum_email, self).default_get(cr, uid, fields, context=context)
for meeting in meeting_pool.browse(cr, uid, record_ids, context=context):
sprint = meeting.sprint_id
if 'scrum_master_email' in fields:
res.update({'scrum_master_email': sprint.scrum_master_id and sprint.scrum_master_id.user_email or False})
if 'product_owner_email' in fields:
res.update({'product_owner_email': sprint.product_owner_id and sprint.product_owner_id.user_email or False})
if 'subject' in fields:
subject = _("Scrum Meeting : %s") %(meeting.date)
res.update({'subject': subject})
if 'message' in fields:
message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name)
res.update({'message': message})
return res
开发者ID:fofowisworkingattelenais,项目名称:modulmodul,代码行数:29,代码来源:project_scrum_email.py
示例19: _create_pos
def _create_pos(obj, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
pos_obj = pool.get('pos.order')
patient_obj = pool.get('medical.patient')
lab_test_obj = pool.get('medical.patient.lab.test')#lab_test_ids
pos_data={}
patient = patient_obj.browse( cr, uid, data['ids'])[0]
if patient.name.insurance:
pos_data['partner_id'] = patient.name.insurance[0].company.id
pos_data['note']="Patient name :"+patient.name.name+" with insurance No. : "+patient.name.insurance[0].name
else:
pos_data['partner_id'] = patient.name.id
lab_test_ids = lab_test_obj.search(cr, uid, [('doctor_id','=',data['form']['doctor_id']),('state','=','draft'),('patient_id','=',patient.id)])
test_line=[]
for test in lab_test_obj.browse(cr, uid, lab_test_ids):
test_line.append((0,0,{'product_id':test.name.product_id.id,
'qty':1,
'price_unit':test.name.product_id.lst_price}))
if test_line:
pos_data['lines'] = test_line
pos_id = pos_obj.create(cr, uid, pos_data)
return {
'domain': "[('id','=', "+str(pos_id)+")]",
'name': 'POS',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'pos.order',
'type': 'ir.actions.act_window'
}
raise wizard.except_wizard(_('UserError'),_('No Lab test exist for selected Dr.'))
开发者ID:elmerdpadilla,项目名称:odoo,代码行数:35,代码来源:wizard_create_lab_pos.py
示例20: export
def export(self, cr, uid, id, options=None, context=None):
if options is None:
options = []
if not context:
context={}
context.update({'force_export':True})
shop_ids = self.read(cr, uid, id, context=context)[0]['shop']
sale_shop_obj = self.pool.get('sale.shop')
product_obj = self.pool.get('product.product')
context['force_product_ids'] = context['active_ids']
for shop in sale_shop_obj.browse(cr, uid, shop_ids, context=context):
context['shop_id'] = shop.id
if not shop.referential_id:
raise osv.except_osv(_("User Error"), _("The shop '%s' doesn't have any external referential are you sure that it's an externe sale shop? If yes syncronize it before exporting product")%(shop.name,))
connection = shop.referential_id.external_connection()
context['conn_obj'] = connection
none_exportable_product = set(context['force_product_ids']) - set([product.id for product in shop.exportable_product_ids])
if none_exportable_product:
products = ', '.join([x['name'] for x in product_obj.read(cr, uid, list(none_exportable_product), fields = ['name'], context=context)])
raise osv.except_osv(_("User Error"), _("The product '%s' can not be exported to the shop '%s'. \nPlease check : \n - if their are in the root category \n - if the website option is correctly configured. \n - if the check box Magento exportable is checked")%(products, shop.name))
if 'export_product' in options:
sale_shop_obj.export_products(cr, uid, shop, context)
if 'export_inventory' in options:
product_obj.export_inventory(
cr, uid,
context['force_product_ids'],
shop.id,
connection,
context=context)
return {'type': 'ir.actions.act_window_close'}
开发者ID:ashishoist91,项目名称:Amazon,代码行数:33,代码来源:export_product.py
注:本文中的tools.translate._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论