rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def onchange_uom(self, cr, uid, ids, product_uom, ):
def onchange_uom(self, cr, uid, ids, product_uom=False): ret = {}
def onchange_uom(self, cr, uid, ids, product_uom, ): if not product_uom: return {} ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coe...
ret={}
if not ids: return {}
def onchange_uom(self, cr, uid, ids, product_uom, ): if not product_uom: return {} ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coe...
coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coeff_uom2def * coeff_def2uom ret['planned_outgoing'] = rounding(coeff * val.planned_outgoing, round_value) ret['to_procure'] = rounding(coe...
if val.active_uom: coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coeff_uom2def * coeff_def2uom ret['planned_outgoing'] = rounding(coeff * val.planned_outgoing, round_value) ret['to_procu...
coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {})
def _to_default_uom_factor(self, cr, uid, val, uom_id, context):
def _to_default_uom_factor(self, cr, uid, val, uom_id, context=None):
def _to_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) coef = uom.factor if uom.category_id.id != val.product_id.uom_id.category_id.id: coef = coef / val.product_id.uos_coeff return val.product_id.uom_id.factor / co...
def _from_default_uom_factor(self, cr, uid, val, uom_id, context):
def _from_default_uom_factor(self, cr, uid, val, uom_id, context=None):
def _from_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) res = uom.factor if uom.category_id.id != val.product_id.uom_id.category_id.id: res = res / val.product_id.uos_coeff return res / val.product_id.uom_id.factor,...
vals['partner_id'] = __get_partner_id(cr, uid, \
vals['partner_id'] = self.__get_partner_id(cr, uid, \
def create(self, cr, uid, vals, context=None): if not context: 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 cont...
if False: obj_model = self.pool.get(vals['res_model']) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_m...
obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and ...
def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ if False: obj_model = self.pool.get(vals['res_model']) if obj_model._name...
unit=False, context=None):
unit=False, journal_id=False, context=None):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ...
flag = False
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ...
pricetype=self.pool.get('product.price.type').browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id)
pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], cont...
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ...
'amount': - round(amount, prec),
'amount': result,
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ...
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id...
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partn...
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id...
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context)
company_id = company_obj._company_default_get(cr, uid, 'account.analytic.line', context=context)
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id, unit=False, journal_id=False, context=None): if context==None: context={} if not journal_id: j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) j_id = j_ids and j_ids[0] or False if not journal_id or no...
for meeting_id in ids: result[meeting_id] = {} if "attendees" in name: attendee_ids = attendee_obj.search(cr, uid, [('ref','=','%s,%d'%(self._name, meeting_id))]) result[meeting_id]["attendees"] = attendee_obj.export_cal(cr, uid, attendee_ids) if "alarms" in name: alarm_ids = alarm_obj.search(cr, uid, [('model_id','=',...
def _get_data(self, cr, uid, ids, name, arg, context): result = {} attendee_obj = self.pool.get('calendar.attendee') alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0] for meeting_id in ids: result[meeting_id] = {} if "at...
attendee_ids = attendee_obj.search(cr, uid, [('ref','=','%s,%d'%(self._name, meeting.id))])
def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0]
'attendee_ids': [(6,0, attendee_ids)],
'attendee_ids': [(6,0, map(lambda x:x.id, meeting.attendee_ids))],
def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0]
'event_end_date' : meeting.date_deadline,
def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0]
cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \
cr.execute("select m.id, m.rrule, m.date, m.exdate from crm_meeting m\
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if isinstance(select, (str, int, long)): ids = [select] else: ids = select result = [] if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting...
def _map_ids(self, method, cr, uid, ids, *args, **argv): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids case_data = self.browse(cr, uid, select) new_ids = [] for case in case_data: if case.inherit_case_id: new_ids.append(case.inherit_case_id.id) res = getattr(self.pool.get('crm.case'), method)(...
def _map_ids(self, method, cr, uid, ids, *args, **argv): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids case_data = self.browse(cr, uid, select) new_ids = [] for case in case_data: if case.inherit_case_id: new_ids.append(case.inherit_case_id.id) res = getattr(self.pool.get('crm.case'), method)(...
cr.execute("SELECT crm_case.user_id, 'busy' as status \ FROM crm_meeting meeting, crm_case \ WHERE meeting.inherit_case_id = crm_case.id \ and crm_case.date <= %s and crm_case.date_deadline >= %s and crm_case.user_id = ANY(%s) and meeting.show_as = %s",
cr.execute("SELECT m.user_id, 'busy' as status \ FROM crm_meeting m\ where m.date <= %s and m.date_deadline >= %s \ and m.user_id = ANY(%s) and m.show_as = %s",
def _get_user_avail(self, cr, uid, ids, context=None): current_datetime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') res = super(res_users, self)._get_user_avail(cr, uid, ids, context) cr.execute("SELECT crm_case.user_id, 'busy' as status \ FROM crm_meeting meeting, crm_case \ WHERE meeting.inherit_case_id =...
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True,states={'done': [('readonly', True)]}),
'picking_id': fields.many2one('stock.picking', 'Reference', select=True,states={'done': [('readonly', True)]}),
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru...
c.priority,c.type_action,c.date_deadline,c.date_closed
c.priority,c.type_action,c.date_deadline,c.date_closed,c.id
def init(self, cr):
categ_ids = categ_obj.search(cr, uid, [('name','ilike','Part%')])
categ_ids = categ_obj.search(cr, uid, [('object_id.model','=','crm.lead')])
def make_opportunity(self, cr, uid, ids, context): """ @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 context: A standard dictionary for contextual values """
'categ_id' : categ_ids[0],
'categ_id' : categ_ids and categ_ids[0] or '',
def make_opportunity(self, cr, uid, ids, context): """ @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 context: A standard dictionary for contextual values """
tax_ids = tax_obj.search(cr, uid, [('company_id', '=', company_id)])
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) tax_obj = self.pool.get('account.t...
sale_taxes_def = map(lambda x: x.id, res.taxes_id) sale_tax_ids = [tax for tax in tax_ids if tax in sale_taxes_def] sale_taxes = tax_obj.browse(cr, uid, sale_tax_ids) sale_taxes_all = sale_taxes and sale_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id = fpos_obj.map_tax(cr, ...
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
sale_taxes_def = map(lambda x: x.id, res.taxes_id)
pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id) pur_tax_ids = [tax for tax in tax_ids if tax in pur_taxes_def] pur_taxes = tax_obj.browse(cr, uid, pur_tax_ids) pur_taxes_all = pur_taxes and pur_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id = fpos_obj.map_tax(cr,...
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False) tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id)
sum(l.product_qty*l.price_unit) as price_total,
l.price_unit*l.product_qty*u.factor as price_total,
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'purchase_report') cr.execute(""" create or replace view purchase_report as ( select min(l.id) as id, s.date_order as date, to_char(s.date_order, 'YYYY') as name, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_appro...
'type': fields.selection([('product','Stockable Product'),('rima','Rima'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way requisitions are processed. Consumables are stockable products with infinite stock, or for use when you have no inventory management in the s...
'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way requisitions are processed. Consumables are stockable products with infinite stock, or for use when you have no inventory management in the system."),
def _calc_seller_delay(self, cr, uid, ids, name, arg, context={}): result = {} for product in self.browse(cr, uid, ids, context): if product.seller_ids: result[product.id] = product.seller_ids[0].delay else: result[product.id] = 1 return result
new_id = cashmove_ref.createcr, uid, {'name': order.product.name+' order',
new_id = cashmove_ref.create(cr, uid, {'name': order.product.name+' order',
def confirm(self,cr,uid,ids,box,context):
}
})
def confirm(self,cr,uid,ids,box,context):
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
if order.cashmove.id: self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
def lunch_order_cancel(self, cr, uid, ids, context):
self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'})
self.action_assign(cr, uid, [move.move_dest_id.id])
def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ partial_datas='' picking_ids = [] move_ids = [] partial_obj=self.pool.get('stock.partial.picking') wf_service = netsvc.LocalService("workflow") partial_id=partial_obj.search(cr,...
for case in self.browse(cr, uid, ids, context): if field_name != 'avg_answers': state = field_name[5:] cr.execute("select count(*) from crm_lead where \ section_id =%s and state='%s'"%(case.section_id.id, state)) state_cases = cr.fetchone()[0] perc_state = (state_cases / float(case.nbr)) * 100 res[case.id] = perc_stat...
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), 'day': fields.char('Day', size=128, readonly=True),
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('object_id.model', '=', 'hr.applicant')]"),
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity)
taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, address_id=line.invoice_id.address_invoice_id, partner=line.invoice_id.partner_id)
def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict): res = {} tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') for line in self.browse(cr, uid, ids): price = line.price_unit * (1-(line.discount or 0.0)/100.0) taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, p...
'project_id': procurement.project_id and procurement.project_id.id or False,
'project_id': procurement.product_id.project_id and procurement.product_id.project_id.id or False,
def action_produce_assign_service(self, cr, uid, ids, context=None): if context is None: context = {} for procurement in self.browse(cr, uid, ids): self.write(cr, uid, [procurement.id], {'state': 'running'}) planned_hours = procurement.product_qty task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s...
res['fiscalyear'] = data['form']['fiscalyear_id']
res['fiscalyear'] = data['form'].get('fiscalyear_id', False)
def set_context(self, objects, data, ids, report_type=None): new_ids = ids res = {} self.period_ids = [] period_obj = self.pool.get('account.period') res['periods'] = '' res['fiscalyear'] = data['form']['fiscalyear_id']
elif arg[0] == 'name':
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): job_ids = [] for arg in args: if arg[0] == 'address_id': self._order = 'sequence_partner' elif arg[0] == 'contact_id': self._order = 'sequence_contact' elif arg[0] == 'name': contact_obj = self.pool.get('res.partner.contact')...
cr.execute('SELECT emp.department_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id = emp.resource_id \ WHERE res.user_id = %s AND emp.department_id IS NOT NULL', (user_id,))
cr.execute('SELECT emp.department_id FROM hr_employee AS emp \ JOIN resource_resource AS res ON res.id = emp.resource_id \ JOIN hr_department as dept ON dept.id = emp.department_id \ WHERE res.user_id = %s AND emp.department_id IS NOT NULL AND dept.manager_id IS NOT NULL', (user_id,))
def _parent_compute(self, cr, uid, ids, name, args, context=None): if context is None: context = {} result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)]) cr.execute('SELECT emp.department_id FROM hr_employee AS emp J...
'incoterm': fields.selection(_incoterm_get, 'Incoterm', size=3, help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction"),
'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction"),
def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys()
interface.register_all(db)
self.pool.get('ir.actions.report.xml').register_all(cr = db.cursor())
def upload_report(self, cr, uid, report_id, file_sxw, file_type, context): ''' Untested function ''' pool = pooler.get_pool(cr.dbname) sxwval = StringIO(base64.decodestring(file_sxw)) if file_type=='sxw': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb') if fi...
hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
if uparts[0] and uparts[1]: hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc)) else: hurl = '%s%s' % (davpath, urllib.quote(fileloc))
def _prop_elem_child(pnode, pns, v, pns_prefix):
hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
if uparts[0] and uparts[1]: hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc)) else: hurl = '%s%s' % (davpath, urllib.quote(fileloc))
def mk_propname_response(self,uri,propnames,doc): """ make a new <prop> result element for a PROPNAME request This will simply format the propnames list. propnames should have the format {NS1 : [prop1, prop2, ...], NS2: ...} """ re=doc.createElement("D:response") # write href information uparts=urlparse.urlparse(uri...
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.amount)
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount)
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
def _construct_constraint_msg(self, cr, uid, ids):
def _construct_constraint_msg(self, cr, uid, ids, context=None):
def _construct_constraint_msg(self, cr, uid, ids): def default_vat_check(cn, vn): # by default, a VAT number is valid if: # it starts with 2 letters # has more than 3 characters return cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase vat_country, vat_number = self._split_vat(self.browse(cr, uid, id...
if move.analytic_account_id: anal_val = {} amt = (val['credit'] or 0.0) - (val['debit'] or 0.0) anal_val = { 'name': val['name'], 'ref': val['ref'], 'date': val['date'], 'amount': amt, 'account_id': val['analytic_account_id'], 'currency_id': val['currency_id'], 'general_account_id': val['account_id'], 'journal_id': st...
def button_confirm_cash(self, cr, uid, ids, context={}):
if not turi.startswith('/'): uparts=urlparse.urlparse(turi) turi=uparts[2]
def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
self.parent.log_error("ignore href %s because it is not under request path", turi)
self.parent.log_error("ignore href %s because it is not under request path %s", turi, ul)
def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) period_query_cond=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear'])])
fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id']) period_ids=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear_id'])])
def _load(self, name, form): fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) period_query_cond=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear'])])
self.cr.execute("SELECT MIN(date_start) AS date_start, MAX(date_stop) AS date_stop FROM account_period WHERE id IN %s", (tuple(period_query_cond),)) dates = self.cr.dictfetchall() self._set_variable('date_start', dates[0]['date_start']) self._set_variable('date_stop', dates[0]['date_stop'])
if period_ids: self.cr.execute("SELECT MIN(date_start) AS date_start, MAX(date_stop) AS date_stop FROM account_period WHERE id = ANY(%s)", (period_ids,)) dates = self.cr.dictfetchall() else: dates = False if dates: self._set_variable('date_start', dates[0]['date_start']) self._set_variable('date_stop', dates[0]['date_s...
def _load(self, name, form): fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) period_query_cond=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear'])])
self._load_accounts(form,line['code'],eval(line['definition']),fiscalyear,period_query_cond)
self._load_accounts(form,line['code'],eval(line['definition']),fiscalyear,period_ids)
def _load(self, name, form): fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) period_query_cond=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear'])])
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond):
def _load_accounts(self, form, code, definition, fiscalyear, period_ids):
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): accounts = {} for x in definition['load']: p = x.split(":") accounts[p[1]] = [p[0],p[2]] sum = 0.0 if fiscalyear.state != 'done' or not code.startswith('bpcheck'): query_cond = "(" for account in accounts: query_cond += "aa.code LIKE '" + accou...
query_cond += "aa.code LIKE '" + account + "%' OR "
query_cond += "aa.code LIKE '" + account + "%%' OR "
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): accounts = {} for x in definition['load']: p = x.split(":") accounts[p[1]] = [p[0],p[2]] sum = 0.0 if fiscalyear.state != 'done' or not code.startswith('bpcheck'): query_cond = "(" for account in accounts: query_cond += "aa.code LIKE '" + accou...
query_cond += "aa.code NOT LIKE '"+account+"%' AND "
query_cond += "aa.code NOT LIKE '"+account+"%%' AND "
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): accounts = {} for x in definition['load']: p = x.split(":") accounts[p[1]] = [p[0],p[2]] sum = 0.0 if fiscalyear.state != 'done' or not code.startswith('bpcheck'): query_cond = "(" for account in accounts: query_cond += "aa.code LIKE '" + accou...
closed_cond=" AND (aml.move_id NOT IN (SELECT account_move.id as move_id FROM account_move WHERE period_id IN "+str(tuple(period_query_cond))+" AND journal_id=(SELECT res_id FROM ir_model_data WHERE name='closing_journal' AND module='l10n_fr')) OR (aa.type != 'income' AND aa.type !='expense'))"
closed_cond=" AND (aml.move_id NOT IN (SELECT account_move.id as move_id FROM account_move WHERE period_id = ANY(%s) AND journal_id=(SELECT res_id FROM ir_model_data WHERE name='closing_journal' AND module='l10n_fr')) OR (aa.type != 'income' AND aa.type !='expense'))" query_params.append(list(period_ids))
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): accounts = {} for x in definition['load']: p = x.split(":") accounts[p[1]] = [p[0],p[2]] sum = 0.0 if fiscalyear.state != 'done' or not code.startswith('bpcheck'): query_cond = "(" for account in accounts: query_cond += "aa.code LIKE '" + accou...
query = "SELECT aa.code AS code, SUM(debit) as debit, SUM(credit) as credit FROM account_move_line aml LEFT JOIN account_account aa ON aa.id=aml.account_id WHERE "+query_cond+closed_cond+" AND aml.state='valid' AND aml.period_id IN "+str(tuple(period_query_cond))+" GROUP BY code" self.cr.execute(query)
query = "SELECT aa.code AS code, SUM(debit) as debit, SUM(credit) as credit " \ " FROM account_move_line aml LEFT JOIN account_account aa ON aa.id=aml.account_id "\ " WHERE "+query_cond+closed_cond+" AND aml.state='valid' AND aml.period_id = ANY(%s) GROUP BY code" query_params.append(list(period_ids)) self.cr.execute(q...
def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): accounts = {} for x in definition['load']: p = x.split(":") accounts[p[1]] = [p[0],p[2]] sum = 0.0 if fiscalyear.state != 'done' or not code.startswith('bpcheck'): query_cond = "(" for account in accounts: query_cond += "aa.code LIKE '" + accou...
cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ partial_datas='' picking_ids = [] partial_obj=self.pool.get('stock.partial.picking') partial_id=partial_obj.search(cr,uid,[]) if partial_id: partial_datas=partial_obj.read(cr,ui...
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'), 'category_holiday_id': fields.many2one('hr.holidays', 'Holiday', help='For allocation By Employee Category...
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
def _employee_get(obj, cr, uid, context=None): ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if ids: return ids[0] return False
def _get_category_leave_ids(self, cr, uid, ids): """Returns the leaves taken by the employees of the category if holiday type is 'category'.""" leave_ids = [] for record in self.browse(cr, uid, ids): if record.holiday_type == 'category' and record.type == 'remove': leave_ids += self.search(cr, uid, [('category_holiday_...
def _employee_get(obj, cr, uid, context=None): ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if ids: return ids[0] return False
ids += self._get_category_leave_ids(cr, uid, ids)
def unlink(self, cr, uid, ids, context=None): self._update_user_holidays(cr, uid, ids) ids += self._get_category_leave_ids(cr, uid, ids) self._remove_resouce_leave(cr, uid, ids, context=context) return super(hr_holidays, self).unlink(cr, uid, ids, context)
elif record.holiday_type == 'category' and record.type == 'remove':
elif record.holiday_type == 'category':
def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow") data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0]...
'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': emp.calendar_id.id, 'company_id': emp.company_id.id, 'resource_id': emp.resource_id.id, 'holiday_id':record.id } for leave_id in self.search(cr, uid, [('category_holiday_id', '=', record.id)]): wf_service.trg_validate(uid, '...
'name': record.name, 'type': record.type, 'holiday_type': 'employee', 'holiday_status_id': record.holiday_status_id.id, 'date_from': record.date_from, 'date_to': record.date_to, 'notes': record.notes, 'number_of_days_temp': record.number_of_days_temp, 'parent_id': record.id, 'employee_id': emp.id } leave_ids.append(sel...
def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow") data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0]...
obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow")
def holidays_confirm(self, cr, uid, ids, *args): obj_hr_holiday_status = self.pool.get('hr.holidays.status') obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow") for record in self.browse(cr, uid, ids): user_id = False leave_asked = record.number_of_days_temp leave_ids = [] if record.holi...
leave_ids = []
def holidays_confirm(self, cr, uid, ids, *args): obj_hr_holiday_status = self.pool.get('hr.holidays.status') obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow") for record in self.browse(cr, uid, ids): user_id = False leave_asked = record.number_of_days_temp leave_ids = [] if record.holi...
emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)]) for emp in obj_emp.browse(cr, uid, emp_ids): vals = { 'name': record.name, 'holiday_status_id': record.holiday_status_id.id, 'date_from': record.date_from, 'date_to': record.date_to, 'notes': record.notes, 'number_of_days_temp': record.nu...
def holidays_confirm(self, cr, uid, ids, *args): obj_hr_holiday_status = self.pool.get('hr.holidays.status') obj_emp = self.pool.get('hr.employee') wf_service = netsvc.LocalService("workflow") for record in self.browse(cr, uid, ids): user_id = False leave_asked = record.number_of_days_temp leave_ids = [] if record.holi...
self.write(cr, uid, ids, {'state': 'cancel'}) leave_ids = self._get_category_leave_ids(cr, uid, ids) if leave_ids: self.unlink(cr, uid, leave_ids)
def holidays_cancel(self, cr, uid, ids, *args): self._update_user_holidays(cr, uid, ids) self._remove_resouce_leave(cr, uid, ids) self.write(cr, uid, ids, {'state': 'cancel'}) leave_ids = self._get_category_leave_ids(cr, uid, ids) if leave_ids: self.unlink(cr, uid, leave_ids) # unlink all the leave requests of the cate...
'account_id': line.account_id.id,
'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
def populate_statement(self, cr, uid, ids, context=None):
context.update({'move_line_ids': [line.id]}) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
def populate_statement(self, cr, uid, ids, context=None):
data = obj_pool.browse(cr, uid, data_id[0])
data = obj_data.browse(cr, uid, data_id[0])
def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.templ...
self.write(cr, uid, [inv.id], {'state':'done'}, context=context)
self.write(cr, uid, [inv.id], {'state':'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
def action_done(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') for inv in self.browse(cr, uid, ids, context=context): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) return True
self.write(cr, uid, [inv.id], {'state': 'confirm', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S'), 'move_ids': [(6, 0, move_ids)]})
self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]})
def action_confirm(self, cr, uid, ids, context=None): """ Finishes the inventory and writes its finished date @return: True """ if context is None: context = {}
'product_qty': fields.float('Date End', digits=(16,2)),
'product_qty': fields.float('Quantity', digits=(16,2)),
def tender_done(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'done'}, context=context) return True
cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_ftp' AND state IN ('installed', 'to-install', 'to upgrade') ")
cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_ftp' AND state IN ('installed', 'to install', 'to upgrade') ")
def db_list(self): """Get the list of available databases, with FTPd support """ s = netsvc.ExportService.getService('db') result = s.exp_list(document=True) self.db_name_list = [] for db_name in result: db, cr = None, None try: try: db = pooler.get_db_only(db_name) cr = db.cursor() cr.execute("SELECT 1 FROM pg_class W...
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c)
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c), 'product_uom': _get_uom_id,
def _get_uom_id(self, cr, uid, *args): cr.execute('select id from product_uom order by id limit 1') res = cr.fetchone() return res and res[0] or False
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account defined on this product and Variant account on category of this product is same.'))
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account defined on this product and Variant account on category of this product are same.'))
def _get_accounting_data_for_valuation(self, cr, uid, move, context=None): """ Return the accounts and journal to use to post Journal Entries for the real-time valuation of the move.
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account defined on this product and Variant account on category of this product is same.'))
raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account defined on this product and Variant account on category of this product are same.'))
def _get_accounting_data_for_valuation(self, cr, uid, move, context=None): """ Return the accounts and journal to use to post Journal Entries for the real-time valuation of the move.
""" Finished the inventory
""" Finish the inventory
def action_done(self, cr, uid, ids, context=None): """ Finished the inventory @return: True """
'product_id' : self._getEmployeeProduct(cr,user_id, context= {}), 'product_uom_id' : self._getEmployeeUnit(cr, user_id, context= {}), 'general_account_id' :self. _getGeneralAccount(cr, user_id, context= {}), 'journal_id' : self._getAnalyticJournal(cr, user_id, context= {}),
'product_id' : self._getEmployeeProduct(cr, uid, context), 'product_uom_id' : self._getEmployeeUnit(cr, uid, context), 'general_account_id' :self._getGeneralAccount(cr, uid, context), 'journal_id' : self._getAnalyticJournal(cr, uid, context),
def on_change_user_id(self, cr, uid, ids, user_id): if not user_id: return {} return {'value' : { 'product_id' : self._getEmployeeProduct(cr,user_id, context= {}), 'product_uom_id' : self._getEmployeeUnit(cr, user_id, context= {}), 'general_account_id' :self. _getGeneralAccount(cr, user_id, context= {}), 'journal_id' :...
if case.type == 'lead':
if case.type == 'lead' or context.get('stage_type',False)=='lead':
def write(self, cr, uid, ids, vals, context=None): if 'date_closed' in vals: return super(crm_lead,self).write(cr, uid, ids, vals, context=context) if 'stage_id' in vals and vals['stage_id']: stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context) self.history(cr, uid, ids, _('St...
self.log(cr, uid, case.id, message)
def write(self, cr, uid, ids, vals, context=None): if 'date_closed' in vals: return super(crm_lead,self).write(cr, uid, ids, vals, context=context) if 'stage_id' in vals and vals['stage_id']: stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context) self.history(cr, uid, ids, _('St...
message = _('Purchase order ') + " '" + purchase.name + "' "+ _("is cancelled") self.log(cr, uid, id, message)
for (id,name) in self.name_get(cr, uid, ids): message = _('Purchase order ') + " '" + purchase.name + "' "+ _("is cancelled") self.log(cr, uid, id, message)
def action_cancel(self, cr, uid, ids, context={}): ok = True purchase_order_line_obj = self.pool.get('purchase.order.line') for purchase in self.browse(cr, uid, ids): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): raise osv.except_osv( _('Could not cancel purchase order !'), _('You must firs...
uos = False result.update({'type': product_obj.procure_method})
uos = False
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): if not partner_id: raise osv.except_osv(_('No Customer Defined !'), _('You have to select ...
order_obj=self.pool.get('pos.order') record_id=context.get('record_id')
order_obj = self.pool.get('pos.order') active_ids = context.get('active_ids')
def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A d...
for order in order_obj.browse(cr, uid,[record_id]):
for order in order_obj.browse(cr, uid, active_ids):
def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A d...
context={} record_id=context.get('record_id') for order in order_obj.browse(cr, uid,[record_id]):
context={} active_ids=context.get('active_ids') for order in order_obj.browse(cr, uid, active_ids):
def view_init(self, cr, uid, fields_list, context=None): res = super(pos_return, self).view_init(cr, uid, fields_list, context=context) order_obj=self.pool.get('pos.order') if not context: context={} record_id=context.get('record_id') for order in order_obj.browse(cr, uid,[record_id]): for line in order.lines: if 'retu...
order_obj=self.pool.get('pos.order') record_id = context.get('record_id', False) if record_id:
active_model = context.get('active_model') if not active_model and active_model != 'pos.order': return result order_obj = self.pool.get('pos.order') active_id = context.get('active_id', False) if active_id:
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) if not context: context={} order_obj=self.pool.get('pos.order') record_id = context.get('record_id', Fals...
order=order_obj.browse(cr, uid, record_id)
order=order_obj.browse(cr, uid, active_id)
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) if not context: context={} order_obj=self.pool.get('pos.order') record_id = context.get('record_id', Fals...
record_id = context.get('record_id', False)
active_id = context.get('active_id', False)
def create_returns2(self, cr, uid, ids, context): record_id = context.get('record_id', False) order_obj =self.pool.get('pos.order') line_obj = self.pool.get('pos.order.line') picking_obj = self.pool.get('stock.picking') stock_move_obj = self.pool.get('stock.move') property_obj= self.pool.get("ir.property") uom_obj =sel...
if record_id: picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
if active_id: picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[active_id]), ('state', '=', 'done')])
def create_returns2(self, cr, uid, ids, context): record_id = context.get('record_id', False) order_obj =self.pool.get('pos.order') line_obj = self.pool.get('pos.order.line') picking_obj = self.pool.get('stock.picking') stock_move_obj = self.pool.get('stock.move') property_obj= self.pool.get("ir.property") uom_obj =sel...
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
def create_returns2(self, cr, uid, ids, context): record_id = context.get('record_id', False) order_obj =self.pool.get('pos.order') line_obj = self.pool.get('pos.order.line') picking_obj = self.pool.get('stock.picking') stock_move_obj = self.pool.get('stock.move') property_obj= self.pool.get("ir.property") uom_obj =sel...
if not context.get('record_id', False):
if not context.get('active_id', False):
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
record_id=context.get('record_id', False)
active_id=context.get('active_id', False)
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[active_id]), ('state', '=', 'done')])
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
order_obj.add_product(cr, uid, record_id,data['product_id'],data['quantity'], context=context)
order_obj.add_product(cr, uid, active_id,data['product_id'],data['quantity'], context=context)
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
order_obj.write(cr,uid,record_id,{'last_out_picking':new_picking})
order_obj.write(cr,uid,active_id,{'last_out_picking':new_picking})
def select_product(self, cr, uid, ids, context): """ 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 : Retrun the add product form again for adding more product "...
record_id=context.get('record_id', False)
active_id=context.get('active_id', False)
def close_action(self, cr, uid, ids, context):
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', [record_id]), ('state', '=', 'done')])
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', [active_id]), ('state', '=', 'done')])
def close_action(self, cr, uid, ids, context):