Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4071 Zobrazení

I have a billing module that has a model "hospital.billing" with one2many relationship "hospital.account.lines" , it is like POS module with "pos.order" and pos.order.line",stock picking in POS is in pos.order model but my stock picking is in hospital account lines model since my transaction always in hospital account lines. Everytime the patient order a medicine  will be added its to Statement of Account. Since patient has only one SOA. This is my model stucture.
          
   _name="hospital.billing"
    _description="Hospital Billing System"
    
    _columns={
              
              'name' : fields.char ('Bill Number',required=True,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}, size=20),
              'date_processed': fields.date('Date Processed', select=True, readonly=True),
              'patient_case_id' : fields.many2one ('his.admission', 'Patient Admission', required=True, states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}),
              'inpac_rmbd_invoices' : fields.one2many ('hospital.roomboard_invoice', 'name', 'In-Patient Room and Board Lines' ,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}),

              'billing_soa_lines' : fields.one2many ('hospital.account.lines', 'name', 'In-Patient SOA Lines' ,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}),
              'creditor_id' : fields.one2many ('creditor.mgmt', 'creditor', 'Creditors' ,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]},domain=[('refund','=',False)]),
              'note': fields.text('Note' ,states={'process':[('readonly',True)], 'cancel':[('readonly',True)]}),
              'opd': fields.boolean('Out Patient'),
              'date_created':fields.datetime('Date Created'),
              'data_encoder':fields.many2one('res.users','Data Created by',readonly=True),
              'company_id':fields.related('data_encoder','company_id',type="many2one",relation="res.company",store=True,readonly=True,string="Company")

              
        _name="hospital.account.lines"
        _description ="Hospital Account lines"
        
        
        _columns={
                   'product_id':fields.many2one('product.product','Products',required=True),
                   'quantity':fields.float('Quantity',required=True),
                   'price_unit':fields.float('Price Unit',),
                   'discount':fields.float('Discount %'),
                   'price_subtotal':fields.function(price_subtotal,method=True,type="float",string="Price Subtotal w/o   Tax",store=False,readonly=True),
                   'creditor_amt':fields.function(creditor_amt,string='Creditor',type="float",method=True,readonly=True),
                   #'creditor_amt':fields.float('Creditor Amount',readonly=True),
                   'patient_amount':fields.function(patient_amount,method=True,type="float",string="Patient               Amount",store=False,readonly=True),
                   **'picking_id':fields.many2one('stock.picking','Stock Picking'),**
                   'pricelist_id':fields.many2one('product.pricelist','Product Pricelist'),
                   'primary_shop_id':fields.many2one('sale.shop','Primary Shop',),
                   'secondary_shop_id':fields.many2one('sale.shop','Secondary Shop'),
                   'date_created':fields.date('Date Created'),
                   'user_id':fields.many2one('res.users','Salesman'),
    }

Avatar
Zrušit
Nejlepší odpověď

Abegail,

There should be a field in hospital.account.lines for many2one ref to hospital.billing.

What you can do is, upon validating/confirmng the SOA(billing), create a picking and link it to hospital.account.lines.

Better solution, you should link hospital.account.lines with stock.move (many2one), and hospital.billing should have many2one for stock.picking.

Thanks.

Avatar
Zrušit
Autor Nejlepší odpověď

Thanks,

Yes, hospital account lines has a many2one rel to hospital billing.

How about if I will refund a medicine or products? Will I use the same stock picking id for the whole hospital account lines or I need to update/change it in every transaction?

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
zář 23
7538
2
bře 23
46594
2
pro 23
57551
0
bře 22
2254
3
čvn 20
10521