I have a completely customized SAP screen used to create rental agreements. When tax jurisdiction is selected using the Help/Dialog (ie. F4 button) option, it causes the non-editable State and County tax fields to be populated. These two fields are strictly for display so that the user can validate their tax jurisdiction against the actual state and county.
To ensure all fields on the entire screen are valid, the program uses a PAI field chaining as shown below. The issue is that if I manually enter a new value in the tax jurisdiction field and press enter, then unless all other fields in the chain are also valid, then the state and county are not updated.
I manually force the updating of the state and county fields using function module DYNP_VALUES_UPDATE, which works great, except for when one of the other fields in the below is invalid. How can I force the state and county fields to be updated on the screen even when one of the other fields in the chain is invalid? I'm starting to think this is simply not possible.
The tax jurisdiction field is called kna1-txjcd
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE setup_defaults.
MODULE screen_modify.
MODULE ltext_add_comments_0100.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
MODULE user_command_0100.
FIELD t001-bukrs MODULE check_sales_org. "DV1K933404
FIELD kna1-j_3gagext
MODULE check_customer_sales_area.
CHAIN.
FIELD: kna1-j_3gagext
MODULE check_cust_num.
MODULE verify_recipient. "DV1K935780
FIELD: zsd_etm_contract-bill_to_party
MODULE check_bill_to_party.
FIELD zsd_etm_contract-payer
MODULE check_payer_number. "CHG12588
ENDCHAIN.
CHAIN.
FIELD: kna1-txjcd
MODULE check_txjcd. "DV1K933404
FIELD: zsd_etm_contract-rig_num,
zsd_etm_contract-ship_via.
FIELD zsd_etm_contract-well_name.
FIELD:
zdls_ls, zdls_sc, zdls_twp, zdls_rg, zdls_m.
FIELD: znts_qtr_unit, znts_unit, znts_block,
znts_map.
FIELD: zlsd_other.
MODULE check_lsd_num .
FIELD: zsd_etm_contract-contact_tel_num,
zsd_etm_contract-cus_rep_loc,
zsd_etm_contract-cus_rep_tel_num,
zsd_etm_contract-cus_rep_fax_num,
zsd_etm_contract-cus_rep_email, "dv1k931160
zsd_etm_contract-lrg_contract, "DV1K935629
t001-bukrs, "DV1K935752
zsd_etm_contract-lrg_camp, "DV1K935752
zsd_etm_contract-customer_contact. "DV1K931062
FIELD:
zsd_etm_contract-cus_rep_loc
MODULE check_cus_rep_loc,
zsd_etm_contract-afe,
zsd_etm_contract-po,
zsd_etm_contract-msa,
zsd_etm_contract-cost_center,
zsd_etm_contract-gl
MODULE check_afe_po_msa_num,
zsd_etm_contract-invoice_approval
MODULE check_invoice_approval,
zsd_etm_contract-usage_type
MODULE check_usage_type.
FIELD: zsd_etm_contract-lrg_contract, "DV1K935629
t001-bukrs, "DV1K935752
zsd_etm_contract-lrg_camp. "DV1K935752
MODULE check_lrg_entries. "DV1K935752
FIELD:
zsd_etm_contract-prl_rep
MODULE check_prl_rep,
zsd_etm_contract-branch
MODULE check_branch,
zsd_etm_contract-bill_region, t001-bukrs
MODULE check_bill_region,
zsd_etm_contract-eoj_bill
MODULE check_eoj_bill,
zsd_etm_contract-sd_shd_flag,
zsd_etm_contract-next_set_date
MODULE check_next_set_date,
zsd_etm_contract-audit_flag,
zsd_etm_contract-ratetype. " CHG13225 DV1K939527
ENDCHAIN.
CHAIN.
FIELD: zsd_etm_contract-usage_type,
zsd_etm_contract-well_type.
MODULE check_well_type.
ENDCHAIN.
FIELD zsd_etm_contract-well_type.
MODULE get_well_type_text.
FIELD zsd_etm_contract-unit_num MODULE check_unit_num.
CHAIN.
FIELD: zsd_etm_contract-afe,
zsd_etm_contract-po,
zsd_etm_contract-msa,
zsd_etm_contract-gl.
MODULE combine_fields.
ENDCHAIN.
MODULE fill_wa_etm_contract.
MODULE check_ltext.
MODULE user_command_create_0100.
PROCESS ON VALUE-REQUEST.
FIELD: kna1-txjcd
MODULE help_txjcd,
zsd_etm_contract-prl_rep
MODULE help_prel_rep,
zsd_etm_contract-bill_to_party
MODULE help_bill_to_party.
FIELD: zsd_etm_contract-payer
MODULE help_payer.
FIELD: zsd_etm_contract-ratetype " CHG13225 DV1K939527
MODULE help_ratetype. " CHG13225 DV1K939527
UPDATE
Below is a screenshot that shows the screen when I initially provide the Tax Jurisdiction Code using the F4 option. Note that the State, County and City as well as the corresponding taxes are updated.
In the below image I have changed the tax jurisdiction manually by typing in a new value, then pressed ENTER. Note that the State, County and City as well as the corresponding taxes have remained the same. They should have updated to completely different values, but do not appear to be doing so because of the CHAIN issue (i.e. screen updates do not happen because a field is in an invalid state).
You can "HACK" the screen using CALL FUNCTION 'DYNP_VALUES_UPDATE'
Reconsider when and how errors are thrown.
To avoid the field module versus chain module issue.
eg Issuing an error after all field modules and chain modules
Related
In odoo 15 I have created a PDF report for invoices using a custom layout via an external module. The address of the customer is specified at the top left of the first page of the PDF report. The content comes from the record that was created via "Customer" (res.partner) and selected via the field "partner_id". After the selection, the street and postal code as well as city are loaded in the edit view of an invoice and thus transferred to the PDF document.
How can I extend or overwrite the address field in my custom report layout to create an own address field that comes from the customer data (model res.partner)? I have created an additional field there via a module (address_suffix) that can store an address addition. I would like to be able to include this custom field of res.partner in the address field at account.move and in the end into the PDF report.
To illustrate it:
I want this field (address_suffix in res.partner)
can be seen here (account.move):
You can check the OCA partner_address_street3 module. It is similar to yours, it adds a third street field (street3) to store additional address information.
The module extends the address format, so it should automatically show on reports
On your report xm, I think you can try using t-field and using widget contact inside the t-options tag.
Example:
<span t-field="partner_id" t-options='{"widget": "contact", "fields": ["address"]}'/>
I have a module named uniform request, which contains a field named select product, which contains inherited data from another module named product. Product, when I select the product I want to purchase a button shows named send request to purchase, after selection a confirmation button shows and after confirming the request I have the option to make new quotation, but when I try to make the new quotation an error message shows:
ValueError: Expected singleton : product. Uom()
It seems you need to assign UoM (Unit of Measure) to the selected product, make sure that you insert a valid value of this field uom_id.
i have two module opportunities and job positions .
i am trying to use only one field of "job positions" name Employees in "opportunities" module.
i am new in openerp and have no knowledge about python . so i am using developer option of openerp . i am attaching my both module file .
Is there any attribute of fields or other so my field will use the value of other module values like as :-
crm.lead xml file:-
<field name="name" module="hr.job" />
here module is not using value of "hr.job" and using of "crm.lead" value.
if i used other name it give me "not field found" error.
please expert help me
You seem pretty confused. What you've attached are view files for your modules, for instance one of them is the form view for object named hr.job. This is not as you call it "module files".
What you need to do is create a many2one (or many2many) field from the referenced object you want to the target object you need, meaning adding a field to whatever class's columns you need in the corresponding py file and not view. A very simple example for a class named opportunity_opportunity:
class opportunity_opportunity (osv.osv):
_name = "opportunity.opportunity"
_columns = {
'name' : fields.char('Name', size=64),
'employee_id': fields.many2one('job.position','name')
}
opportunity_opportunity()
you can later add it in the opportunity_view.xml file as any other field:
<field name="employee_id" string="Employee"/>
More importantly, I think you need to seriously first read and understand the developer book: OpenERP 6.1 Developer Book
EDIT: I just noticed you had already posted the same question yesterday here link, this is very frowned upon in stackoverflow. Please take your time to read the openerp documentation before posting questions.
Sometimes our OpenERP users want to make a small change to a field in a core OpenERP module. For example, they want the product screen's Rack, Row, and Case fields to be longer than 16 characters.
Can I change an existing field without making changes to the module that declared it? I'd rather make the changes using our own custom module, instead of editing the product module itself.
I've got this working, but I'm hoping that someone else knows a cleaner way.
You can inherit the core module's class in your custom module, and then just declare a new field with the same name as the one you want to change. Essentially, just copy the field declaration from the core module, paste it into your custom module, and then make the changes you want. For example, our product_notes module widened the Rack, Row, and Case fields to 255 from the product module's 16.
_columns = {'loc_rack': fields.char('Rack', size=255),
'loc_row': fields.char('Row', size=255),
'loc_case': fields.char('Case', size=255)}
The reason I don't like this is that you now have duplication for all the other attributes of the field. If you change the field length, and then the core module changes the help text, you will still have the old help text. I was hoping that there would be some way when the modules are loading to go in and adjust the field attributes of your parent, but I couldn't find any hooks at the right time.
One change that you can make more easily is the default value of a field. Just declare a default value for a core module's field in your custom module, and it will replace the original default. For example, we changed the defaults for sale_delay and produce_delay from those in the product module.
_defaults = {'sale_delay': lambda *a: 5,
'produce_delay': lambda *a: 0}
In ODOO we can change any attribute of a field using xml.
<field name="loc_rack" position="attributes">
<attribute name="string">Axis</attribute>
</field>
But some case like extending the size of a field its failed.
You need to inherit the product form.
Here you go.
from openerp.osv import fields, osv
class product_product(osv.Model) # <<<v7
_inherit = 'product.product'
_columns = {
'loc_rack': fields.char('Rack', size=<your size>),
'loc_row': fields.char('Row', size=<your size>),
'loc_case': fields.char('Case', size=<your size>)
}
In simple words you just need to override the field and apply your attribute changes it will reflect.
I'd like to make a menu in Layout which the items are linked to other different module.
e.g:
Item "Product" linked to an action in Product Module, item "Service" linked to an action in Service Module.
It won't work when I set the 'url'=>('product/<controllerID>/<actionID>') and 'url'=>('service/<controllerID>/<actionID>') because once we're in Product module and click the menu "Service", the URL become
index.php?r=product/service/<controllerID>/<actionID>
instead of
index.php?r=service/<controllerID>/<actionID>
and it will be 404 error. (for sure, because the Service Module isn't inside Product Module but the URL makes it looks like that).
Any solution for this?
Check the createUrl() documentation :
the URL route. This should be in the format of 'ControllerID/ActionID'. If the ControllerID is not present, the current controller ID will be prefixed to the route. If the route is empty, it is assumed to be the current action. If the controller belongs to a module, the module ID will be prefixed to the route. (If you do not want the module ID prefix, the route should start with a slash '/'.)
That last line tells us everything. Best thing to do for you is start all the routes with a / :
'url'=>array('/<moduleID>/<controllerID>/<actionID>')
Check this
'url'=>$this->createUrl('/<moduleId>/<controllerID>/<actionID>')