Skip to content

19.0 purchase-global-discount-pupat : Global discount on the purchase order lines.#1213

Draft
pupat-odoo wants to merge 16 commits intoodoo:19.0from
odoo-dev:19.0-purchase-global-discount-pupat
Draft

19.0 purchase-global-discount-pupat : Global discount on the purchase order lines.#1213
pupat-odoo wants to merge 16 commits intoodoo:19.0from
odoo-dev:19.0-purchase-global-discount-pupat

Conversation

@pupat-odoo
Copy link
Copy Markdown

Title : Add Global Discount Wizard in Purchase Order

Description:

  • Added a button in the Purchase Order form to apply a global discount using a wizard.
  • The wizard takes a discount percentage and applies it to all order lines.

Changes:

  • Added "Apply Discount" button in Purchase Order view
  • Created wizard (purchase.discount.wizard)
  • Applied discount to all purchase.order.line records
  • Extended order line with discount field

Result :

  • Users can easily apply a single discount across all purchase order lines via a popup wizard.

- Created the core estate model and initialized database schema.
- Configured manifest with required metadata and dependencies.
- Handled code cleanup, including license headers and trailing spaces.
- Imported models into the root directory for proper initialization.
- It covers chapter-3 task
- added the required fields.
- Defined access control CSV in the security directory.
- Configured permissions for estate property records.
…ties.

- Added access rights for estate.property model.
- Ensured proper read/write/create/delete permissions.
…constraints.

- This file includes the model's  description.
- Included model description for clarity.
- Added list view to display records in tabular format.

- Added form view with grouped fields.

- Added search view with filter for 'Available' properties and group by postcode.
- used many2one relation in estate_property_type model, signifies
a property has individual type but may assigned to multiple other properties

- used Many2many relationship in estate_property_tag model,signifies a property has multiple tag but one tag can be assigned to multiple  properties.

- used One2many relationship in estate_property_offer model, signifies a property has multiple offer but each offers belongs to one property.
…ch-7)

- corrected the string datatype misspelling

-Changed the same name conflict between 'name' and 'property_type_id'.
…ver(ch-8)

- used compute method to specify the  relationship between fields.

- Inverse function allows to edit the read-only computed fields.

- Onchange method decorator dynamically changes other dependent field values.

This chapter covers the implementation of computed fields and Onchange decorator which allows to perform computations and defines the link between the fields.
…ch-9)

- By adding action buttons , it's easy to have link between fields.

UserError message helps  to get alert message about the actions already done.

This chapters allows us to link action to particular button such as:

Actions button to sold,refused (property) and accept or reject (offers).

User can also get   error message if they do some illogical action.
…rs(ch-10)

- Added constraints to ensure users can only enter valid and intended values.

- Implemented both SQL and Python constraints based on use case.

Types of constraints:

- SQL constraints: Used at database level for better performance with few logic.

- Python constraints: Used for complex business logic and advanced validation.
…vers(ch-11)

- Inline view allows users to create/edit related records  within  parent form.

- widget modifies how a field is rendered in UI without changing backend type.

- Decorators dynamically apply CSS styling to records based on conditions.

 created status widget for automatic state transactions.

- define One2many relationship to properties and a computed offer_count field.

- Added a smart button to provide contextual access to related records directly from the form view.

This change enables better categorization of properties and improves usability by allowing users to quickly access and analyze offers associated with each property type directly from the form view.
- CRUD opertions implemented using python inheritance.

- res_users model is created which inherits the estate model feature.

- It uses the same property list feature but of  specific  users such as admin.

- Main feature of inheritance is res_user is sychronized with base field values.
…unt (ch-13)

- Created estate_account module by inheriting estate_property model.

- Invoice generation enables customers to get the billing  details of property.

- invoice lines handles the commission and administrative fees.

This chapter covers the inheritance part and also delivers how different modules link  with each other.
- Qweb  template engine mostly used to generate HTML fragments and pages.

- used kanban view to give dynamic look to the property attributes.

- default_group_by attribute helps to filter the specfic property attributes.

- conditional statement also applied in the kanban view.

This chapter signifies the Qweb templating engine and the kanban visualization which represent the workflow stages allowing users to track progress drag-and-drop tasks to update statuses.
…er lines.

Purpose :

- Applying global discount to all order lines , avoids the manual setting of indivial discount enrtries.

- Allows discount value to be represented in native monetary values.

Features :

- Added a discount button below the order lines which opens a wizard dialog box.

- Implemented  wizard view for adding the discount value with its specific type.

-  with a single click on  'Apply' button, all the order lines amount get updated with new one.

Technical insights:

1) Added 'purchase_order' model which is implemented using Transient model.

2) 'purchase_order_discount'  wizard view added .
@robodoo
Copy link
Copy Markdown

robodoo commented Mar 26, 2026

Pull request status dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants