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

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.




Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit

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.

Related Posts Odpovědi Zobrazení Aktivita
0
srp 23
1137
1
čvc 22
97
1
kvě 24
1237
1
lis 24
1932
1
srp 23
2350