Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2181 Widoki

Hello!


Has anyone ever needed yo change a project on a purchase order line, or several, once this has already been invoiced?

How can It be done?

Thanks you! 

Odoov15.




Awatar
Odrzuć
Najlepsza odpowiedź

If you Reset Invoice to Draft and then Cancel, you can change the purchase order line.  

It is also possible to change Analytic Account on the Vendor bill, if you reset it to draft.

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

The `product_id` field becomes read-only when the state is set to 'purchase'. Here's the condition that makes it read-only:

'readonly': [('state', 'in', ('purchase', 'to approve','done', 'cancel'))],

If you need to edit the `product_id` field after the state has been changed to 'purchase', you can achieve this by replacing the field with a new XML tag that has the same field name. This XML tag should not have the 'readonly' attribute set to restrict editing. This will allow you to modify the `product_id` field even when the state is 'purchase'.

<record id="purchase_order_form" model="ir.ui.view">

        <field name="name">purchase.order.inherit.your.module</field>

        <field name="model">purchase.order</field>

        <field name="inherit_id" ref="purchase.purchase_order_form"/>

        <field name="arch" type="xml">

            <field name="product_id" position="replace">

                <field name="product_id"

                       attrs="{'required': [('display_type', '=', False)]}"

                       context="{'partner_id':parent.partner_id, 'quantity':product_qty,'uom':product_uom, 'company_id': parent.company_id}"

                       force_save="1"

                       domain="[('purchase_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>

            </field>

        </field>

    </record>

Removing the 'readonly' attribute to allow editing of the `product_id` field after the state has changed to 'purchase' might introduce unintended or unwanted behavior. Carefully consider the implications of allowing edits in this state to ensure that it aligns with your business logic and requirements.


Hope it helps

Awatar
Odrzuć

Please refrain from giving solutions that could potentially affect on someone's business data if you're not familiar with their specific context. Changing the product_id after stock moves are posted is a risky move, and it's vital to understand the business implications before making such suggestions. Let's prioritize responsible advice that respects the integrity of the data and business processes.

Powiązane posty Odpowiedzi Widoki Czynność
0
sie 23
1140
1
lip 22
97
1
maj 24
1237
1
lis 24
1952
1
sie 23
2355