('open','Open'),
('paid','Done'),
('cancel','Cancelled')
- ],'State', select=True, readonly=True),
-
+ ],'State', select=True, readonly=True,
+ help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Invoice. \
+ \n* The \'Pro-forma\' when invoice is in Pro-forma state,invoice does not have an invoice number. \
+ \n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
+ \n* The \'Done\' state is set automatically when invoice is paid.\
+ \n* The \'Cancelled\' state is used when user cancel invoice.'),
'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}, help="Keep empty to use the current date"),
'date_due': fields.date('Due Date', states={'open':[('readonly',True)],'close':[('readonly',True)]},
help="If you use payment terms, the due date will be computed automatically at the generation "\
if p.property_account_receivable.company_id.id != company_id and p.property_account_payable.company_id.id != company_id:
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)])
- if not rec_pro_id:
+ if not rec_pro_id:
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
if not pay_pro_id:
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)])
if type in ('in_invoice', 'in_refund'):
result['value']['partner_bank'] = bank_id
-
+
if payment_term != partner_payment_term:
if partner_payment_term:
to_update = self.onchange_payment_term_date_invoice(
if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id:
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
- if not rec_pro_id:
+ if not rec_pro_id:
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
if not pay_pro_id:
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)])
context.update({'lang': lang})
result = {}
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
-
+
if company_id:
in_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
if not in_pro_id:
exp_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_expense'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
if not exp_pro_id:
exp_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
-
+
if not in_pro_id:
- in_acc = res.product_tmpl_id.property_account_income
+ in_acc = res.product_tmpl_id.property_account_income
in_acc_cate = res.categ_id.property_account_income_categ
if in_acc:
app_acc_in = in_acc
else:
app_acc_exp = self.pool.get('account.account').browse(cr,uid,exp_pro_id)[0]
if not in_pro_id and not exp_pro_id:
- in_acc = res.product_tmpl_id.property_account_income
+ in_acc = res.product_tmpl_id.property_account_income
in_acc_cate = res.categ_id.property_account_income_categ
ex_acc = res.product_tmpl_id.property_account_expense
ex_acc_cate = res.categ_id.property_account_expense_categ
res2 = res.uom_id.category_id.id
if res2 :
domain = {'uos_id':[('category_id','=',res2 )]}
-
- prod_pool=self.pool.get('product.product')
+
+ prod_pool=self.pool.get('product.product')
result['categ_id'] = res.categ_id.id
res_final = {'value':result, 'domain':domain}
-
+
if not company_id and not currency_id:
return res_final
-
+
company = self.pool.get('res.company').browse(cr, uid, company_id)
currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
-
+
if company.currency_id.id != currency.id and currency.company_id.id == company.id:
new_price = res_final['value']['price_unit'] * currency.rate
res_final['value']['price_unit'] = new_price