Force Update Document Statut after Data Import

Hello,

I migrate my website v11 from v14 with data import about :

  • Work Order
  • Stock Entry
  • Stock Reconciliation
  • Purchase Order
  • Purchase Invoice
  • Payment Entry
  • BOM
  • Batch

All my Stock Entry and Purchase Invoice was imported.
But my Purchase Order, still has To receive To bill badge, while the connection between Purchase Order <> Purchase Invoice <> Purchase Receipt is linked.

How can I force the badge to be completed or ask ErpNext to force a new update about the badge ?

Thank you

Up !

Somone one can help me ?

Thank you

UP, I didn’t close this problem.

It’s painful to see every day that the purchase orders are not completed on the list.

@Raph01 all the po ? even the new ones ?

The new one, works fine, all it’s ok.

The problem was the imported PO for my migration from v11 to v14.

you can open console and manually edit the database

Good idea, Do you know which table I have to set ?

@Raph01 It’s Purchase Order of course

So the Table “tabPurchase Order” the fields of this table is

+---------------------------------+---------------+------+-----+-----------------+-------+
| Field                           | Type          | Null | Key | Default         | Extra |
+---------------------------------+---------------+------+-----+-----------------+-------+
| name                            | varchar(140)  | NO   | PRI | NULL            |       |
| creation                        | datetime(6)   | YES  |     | NULL            |       |
| modified                        | datetime(6)   | YES  | MUL | NULL            |       |
| modified_by                     | varchar(140)  | YES  |     | NULL            |       |
| owner                           | varchar(140)  | YES  |     | NULL            |       |
| docstatus                       | int(1)        | NO   |     | 0               |       |
| idx                             | int(8)        | NO   |     | 0               |       |
| title                           | varchar(140)  | YES  |     | {supplier_name} |       |
| naming_series                   | varchar(140)  | YES  |     | NULL            |       |
| supplier                        | varchar(140)  | YES  | MUL | NULL            |       |
| supplier_name                   | varchar(140)  | YES  |     | NULL            |       |
| order_confirmation_no           | varchar(140)  | YES  |     | NULL            |       |
| order_confirmation_date         | date          | YES  |     | NULL            |       |
| transaction_date                | date          | YES  | MUL | NULL            |       |
| schedule_date                   | date          | YES  |     | NULL            |       |
| company                         | varchar(140)  | YES  |     | NULL            |       |
| apply_tds                       | int(1)        | NO   |     | 0               |       |
| tax_withholding_category        | varchar(140)  | YES  |     | NULL            |       |
| is_subcontracted                | int(1)        | NO   |     | 0               |       |
| supplier_warehouse              | varchar(140)  | YES  |     | NULL            |       |
| amended_from                    | varchar(140)  | YES  |     | NULL            |       |
| cost_center                     | varchar(140)  | YES  |     | NULL            |       |
| project                         | varchar(140)  | YES  |     | NULL            |       |
| currency                        | varchar(140)  | YES  |     | NULL            |       |
| conversion_rate                 | decimal(21,9) | NO   |     | 0.000000000     |       |
| buying_price_list               | varchar(140)  | YES  |     | NULL            |       |
| price_list_currency             | varchar(140)  | YES  |     | NULL            |       |
| plc_conversion_rate             | decimal(21,9) | NO   |     | 0.000000000     |       |
| ignore_pricing_rule             | int(1)        | NO   |     | 0               |       |
| scan_barcode                    | varchar(140)  | YES  |     | NULL            |       |
| set_from_warehouse              | varchar(140)  | YES  |     | NULL            |       |
| set_warehouse                   | varchar(140)  | YES  |     | NULL            |       |
| total_qty                       | decimal(21,9) | NO   |     | 0.000000000     |       |
| total_net_weight                | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_total                      | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_net_total                  | decimal(21,9) | NO   |     | 0.000000000     |       |
| total                           | decimal(21,9) | NO   |     | 0.000000000     |       |
| net_total                       | decimal(21,9) | NO   |     | 0.000000000     |       |
| tax_withholding_net_total       | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_tax_withholding_net_total  | decimal(21,9) | NO   |     | 0.000000000     |       |
| set_reserve_warehouse           | varchar(140)  | YES  |     | NULL            |       |
| tax_category                    | varchar(140)  | YES  |     | NULL            |       |
| taxes_and_charges               | varchar(140)  | YES  |     | NULL            |       |
| shipping_rule                   | varchar(140)  | YES  |     | NULL            |       |
| incoterm                        | varchar(140)  | YES  |     | NULL            |       |
| named_place                     | varchar(140)  | YES  |     | NULL            |       |
| base_taxes_and_charges_added    | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_taxes_and_charges_deducted | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_total_taxes_and_charges    | decimal(21,9) | NO   |     | 0.000000000     |       |
| taxes_and_charges_added         | decimal(21,9) | NO   |     | 0.000000000     |       |
| taxes_and_charges_deducted      | decimal(21,9) | NO   |     | 0.000000000     |       |
| total_taxes_and_charges         | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_grand_total                | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_rounding_adjustment        | decimal(21,9) | NO   |     | 0.000000000     |       |
| base_in_words                   | varchar(240)  | YES  |     | NULL            |       |
| base_rounded_total              | decimal(21,9) | NO   |     | 0.000000000     |       |
| grand_total                     | decimal(21,9) | NO   |     | 0.000000000     |       |
| rounding_adjustment             | decimal(21,9) | NO   |     | 0.000000000     |       |
| rounded_total                   | decimal(21,9) | NO   |     | 0.000000000     |       |
| disable_rounded_total           | int(1)        | NO   |     | 0               |       |
| in_words                        | varchar(240)  | YES  |     | NULL            |       |
| advance_paid                    | decimal(21,9) | NO   |     | 0.000000000     |       |
| apply_discount_on               | varchar(140)  | YES  |     | Grand Total     |       |
| base_discount_amount            | decimal(21,9) | NO   |     | 0.000000000     |       |
| additional_discount_percentage  | decimal(21,9) | NO   |     | 0.000000000     |       |
| discount_amount                 | decimal(21,9) | NO   |     | 0.000000000     |       |
| other_charges_calculation       | longtext      | YES  |     | NULL            |       |
| supplier_address                | varchar(140)  | YES  |     | NULL            |       |
| address_display                 | text          | YES  |     | NULL            |       |
| contact_person                  | varchar(140)  | YES  |     | NULL            |       |
| contact_display                 | text          | YES  |     | NULL            |       |
| contact_mobile                  | text          | YES  |     | NULL            |       |
| contact_email                   | text          | YES  |     | NULL            |       |
| shipping_address                | varchar(140)  | YES  |     | NULL            |       |
| shipping_address_display        | text          | YES  |     | NULL            |       |
| billing_address                 | varchar(140)  | YES  |     | NULL            |       |
| billing_address_display         | text          | YES  |     | NULL            |       |
| customer                        | varchar(140)  | YES  |     | NULL            |       |
| customer_name                   | varchar(140)  | YES  |     | NULL            |       |
| customer_contact_person         | varchar(140)  | YES  |     | NULL            |       |
| customer_contact_display        | text          | YES  |     | NULL            |       |
| customer_contact_mobile         | text          | YES  |     | NULL            |       |
| customer_contact_email          | longtext      | YES  |     | NULL            |       |
| payment_terms_template          | varchar(140)  | YES  |     | NULL            |       |
| tc_name                         | varchar(140)  | YES  |     | NULL            |       |
| terms                           | longtext      | YES  |     | NULL            |       |
| status                          | varchar(140)  | YES  | MUL | Draft           |       |
| per_billed                      | decimal(21,9) | NO   |     | 0.000000000     |       |
| per_received                    | decimal(21,9) | NO   |     | 0.000000000     |       |
| letter_head                     | varchar(140)  | YES  |     | NULL            |       |
| group_same_items                | int(1)        | NO   |     | 0               |       |
| select_print_heading            | varchar(140)  | YES  |     | NULL            |       |
| language                        | varchar(140)  | YES  |     | NULL            |       |
| from_date                       | date          | YES  |     | NULL            |       |
| to_date                         | date          | YES  |     | NULL            |       |
| auto_repeat                     | varchar(140)  | YES  |     | NULL            |       |
| is_internal_supplier            | int(1)        | NO   |     | 0               |       |
| represents_company              | varchar(140)  | YES  |     | NULL            |       |
| ref_sq                          | varchar(140)  | YES  |     | NULL            |       |
| party_account_currency          | varchar(140)  | YES  |     | NULL            |       |
| inter_company_order_reference   | varchar(140)  | YES  |     | NULL            |       |
| is_old_subcontracting_flow      | int(1)        | NO   |     | 0               |       |
| _user_tags                      | text          | YES  |     | NULL            |       |
| _comments                       | text          | YES  |     | NULL            |       |
| _assign                         | text          | YES  |     | NULL            |       |
| _liked_by                       | text          | YES  |     | NULL            |       |
| delivery_details                | text          | YES  |     | NULL            |       |
+---------------------------------+---------------+------+-----+-----------------+-------+

I made a SQL update :

UPDATE `tabPurchase Order` SET `status` = 'Completed'
WHERE `creation` < '2023-04-15' AND NOT `status` IN ('Closed', 'Cancelled', 'Completed');

It succeed : Query OK, 326 rows affected (0.026 sec) Rows matched: 326 Changed: 326 Warnings: 0

But when I reload my Purchase Order View List I don’t see any change, my PO still “To Receive and To Bill” I don’t understand why.

@Raph01 actually you have to update 2 fields , per_billed and per_delivered . it’s the percentage of billing and delivering , so you change them to 100

Thank you, problem solved.

For people who read this post and what the solution.

Bellow the SQL request :

For Purchase Order

UPDATE `tabPurchase Order` SET `status` = 'Completed’, `per_billed` = 100, `per_received` = 100
WHERE `creation` < '2023-04-15' AND NOT `status` IN ('Closed', 'Cancelled', 'Completed');

For Purchase Receipt

UPDATE `tabPurchase Receipt` SET `status` = 'Completed', `per_billed` = 100
WHERE `creation` < '2023-04-15' AND NOT `status` = 'Cancelled';