Need to run special number of invoice & receipt from rd shop.
parent
ebb102e602
commit
649f052e0a
|
@ -49,6 +49,8 @@ class Sequence(Model):
|
|||
["clinic_hdcase","HD Case"],
|
||||
["clinic_dlz","Dialyzer"],
|
||||
["clinic_rdshop","RD Shop"],
|
||||
["clinic_rdshop_credit","RD Shop Credit"],
|
||||
["clinic_rdshop_cash","RD Shop Cash"],
|
||||
["other","Other"]],"Type",required=True,search=True),
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,34 @@ class Shop(Model):
|
|||
return num
|
||||
get_model("sequence").increment_number(seq_id,context=context)
|
||||
|
||||
def _get_credit_number(self,context={}):
|
||||
while 1:
|
||||
seq_id=get_model("sequence").find_sequence(type="clinic_rdshop_credit",context=context)
|
||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||
if not num:
|
||||
return None
|
||||
user_id=get_active_user()
|
||||
set_active_user(1)
|
||||
res=self.search([["number","=",num]])
|
||||
set_active_user(user_id)
|
||||
if not res:
|
||||
return num
|
||||
get_model("sequence").increment_number(seq_id,context=context)
|
||||
|
||||
def _get_cash_number(self,context={}):
|
||||
while 1:
|
||||
seq_id=get_model("sequence").find_sequence(type="clinic_rdshop_cash",context=context)
|
||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||
if not num:
|
||||
return None
|
||||
user_id=get_active_user()
|
||||
set_active_user(1)
|
||||
res=self.search([["number","=",num]])
|
||||
set_active_user(user_id)
|
||||
if not res:
|
||||
return num
|
||||
get_model("sequence").increment_number(seq_id,context=context)
|
||||
|
||||
def _get_branch(self,context={}):
|
||||
res=get_model('select.company').get_select()
|
||||
if res:
|
||||
|
@ -290,7 +318,10 @@ class Shop(Model):
|
|||
cst=get_model('clinic.setting').browse(1)
|
||||
prod_acc=cst.get_product_account
|
||||
partner=obj.contact_id
|
||||
context['branch_id']=obj.branch_id.id
|
||||
number=self._get_credit_number(context=context),
|
||||
vals={
|
||||
'number': number,
|
||||
"type": "out",
|
||||
"inv_type": "invoice",
|
||||
"tax_type": "tax_in",
|
||||
|
@ -421,7 +452,10 @@ class Shop(Model):
|
|||
if not income_account_id:
|
||||
raise Exception("No Income Account")
|
||||
company_id=get_active_company()
|
||||
context['branch_id']=obj.branch_id.id
|
||||
number=self._get_cash_number(context=context),
|
||||
vals={
|
||||
'number': number,
|
||||
"partner_id": partner.id,
|
||||
"company_id": company_id,
|
||||
"type": "in",
|
||||
|
|
Binary file not shown.
|
@ -28,16 +28,12 @@
|
|||
<tr>
|
||||
<td style="width:10%">{{date}}</td>
|
||||
<td style="width:20%">{{pname}}</td>
|
||||
<td>{{pm_number}}</td>
|
||||
{{#ifeq ptype "credit"}}
|
||||
<td>
|
||||
{{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
|
||||
</td>
|
||||
{{else}}
|
||||
<td>
|
||||
{{view "link" string=pm_number action="payment" action_options="mode=form" active_id=pm_id}}
|
||||
</td>
|
||||
{{/if}}
|
||||
<td>
|
||||
{{view "link" string=pm_number action="payment" action_options="mode=form" active_id=pm_id}}
|
||||
</td>
|
||||
<td>
|
||||
{{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
|
||||
</td>
|
||||
<td>{{mdc_name}}</td>
|
||||
<td>{{currency fee zero=""}}</td>
|
||||
<td>{{currency mdc zero=""}}</td>
|
||||
|
|
Loading…
Reference in New Issue