health-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Health-dev] Health_serviceLine (Field : Desc)


From: Bounmy Sihaphom
Subject: Re: [Health-dev] Health_serviceLine (Field : Desc)
Date: Wed, 24 Sep 2014 09:40:56 +0700

Hi All!
I think I found the answer, it works for my case, here how I can make Desc field polpulated automatically at Health_service_line based on the product field:

  @fields.depends('product')
    def on_change_with_desc(self):
        # Return the Current / desc of the product
        if self.product:
            desc=self.product.name
            return desc

Just share  what I can.


Best Regards;

Bounmy Sihaphom
Calat factory Co. Ltd.
Ban Nahai,Hatsaiphong District,Vientiane ,Laos
Mobile:020-5663 6285
mail. address@hidden

Disclaimer:
Confidential information may be contained in this message and may be subject to legal privilege. Access to this e-mail by anyone other than the intended is unauthorized. If you are not the intended recipient (or responsible for delivery of the message to such person), you may not use, copy, distribute or deliver to anyone this message (or any part of its contents ) or take any action in reliance on it. In such case, you should destroy this message, and notify us immediately. 

On Mon, Sep 22, 2014 at 9:45 AM, Bounmy Sihaphom <address@hidden> wrote:

Hi all:

I have searched in the net,Tryton Google Group,IRC and GNUHealth mailing list, there is no place to be found, maybe it is so simple, I am new to Python, I just don't know how, can someone point me to the right direction or give me example for the following scenario:

Model : Health_service

What I can do so far:

      1. Default Srvice date

      2. Default Description (Title not on service line)

      3. Invoice_to as true (so he/she don't need to click at Line Service)

I cannot do this :

Actually I can move Product field and place before “desc” field (do not misunderstood this field actually the same as the title Description, I don't know why?).

      1. I want to make “desc” field value = “Product” field value, and save behind the scene, since “desc” is not null defined in service_line table, how can I do this? This way, she/he enters only Product name and also most of the time the product name is good enough for description. Or stated differntly, when I click save, that product value also populated to “desc” field.

      2. I believe desc field is so important when we create service Invoice, this field not the product field will be printed on draft/pro format invoice.


Here is what I tried:


product = fields.Many2One('product.product', 'Product', required=True)

desc = fields.Char('Description')

to_invoice = fields.Boolean('Invoice')

@staticmethod

def default_to_invoice():

return True

@staticmethod

def default_desc:

return product_product.product



I really appreciate if you can help us out. Thanks.
Best Regards;

Bounmy Sihaphom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]