Initial commit: Sale packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 14e3d26998
6469 changed files with 2479670 additions and 0 deletions

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_template_form_view_invoice_policy_inherit_sale_project" model="ir.ui.view">
<field name="name">product.template.inherit.sale.projectform</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sale.product_template_form_view"/>
<field name="arch" type="xml">
<field name="invoice_policy" position="attributes">
<attribute name="invisible">False</attribute>
<attribute name="attrs">{'invisible': [('type', '=', 'service'), ('sale_ok', '=', True)]}</attribute>
</field>
<field name="invoice_policy" position="after">
<field name="service_policy" string="Invoicing Policy" attrs="{'invisible': ['|', ('type', '!=', 'service'), ('sale_ok', '=', False)], 'required': [('type', '=', 'service'), ('sale_ok', '=', True)]}"/>
<field name="service_tracking" required="1" attrs="{'invisible': [('type', '!=', 'service')]}"/>
<field name="project_id" context="{'default_allow_billable': True}" attrs="{'invisible':[('service_tracking','!=','task_global_project')], 'required':[('service_tracking','==','task_global_project')]}"/>
<field name="project_template_id" context="{'active_test': False, 'default_allow_billable': True}" attrs="{'invisible':[('service_tracking','not in',['task_in_project', 'project_only'])]}"/>
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="project_sharing_inherit_project_task_view_form" model="ir.ui.view">
<field name="name">project.task.view.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.project_sharing_project_task_view_form"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<field name="display_sale_order_button" invisible="1"/>
<button class="oe_stat_button"
type="object" name="action_project_sharing_view_so" icon="fa-dollar"
attrs="{'invisible': [('display_sale_order_button', '=', False)]}"
string="Sales Order"/>
</div>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="options">{'no_open': True, 'no_create': True, 'no_edit': True}</attribute>
<attribute name="context">{'res_partner_search_mode': 'customer'}</attribute>
</xpath>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="commercial_partner_id" invisible="1" />
<field name="sale_line_id" string="Sales Order Item" attrs="{'invisible': [('partner_id', '=', False)]}" options='{"no_open": True}' readonly="1" context="{'create': False, 'edit': False, 'delete': False}"/>
</xpath>
</field>
</record>
<record id="project_sharing_inherit_project_task_view_search" model="ir.ui.view">
<field name="name">project.task.search.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.project_sharing_project_task_view_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="sale_order_id" string="Sale Order" filter_domain="['|', ('sale_order_id', 'ilike', self), ('sale_line_id', 'ilike', self)]"/>
</xpath>
<xpath expr="//group/filter[@name='customer']" position="after">
<!-- TODO: Remove me in master -->
<filter name="sale_order_id" string="Sales Order Id" invisible="1" />
<filter name="group_by_sale_order" string="Sales Order" context="{'group_by': 'sale_order_id'}" />
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="project_project_view_inherit_project_filter" model="ir.ui.view">
<field name="name">project.project.select.inherit.project</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_project_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="sale_order_id"/>
</xpath>
</field>
</record>
<record id="project_project_view_tree_inherit_sale_project" model="ir.ui.view">
<field name="name">project.project.tree.inherit.sale.project</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project"/>
<field name="priority">50</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="sale_line_id" optional="hide" readonly="1"/>
</xpath>
</field>
</record>
<record id="view_edit_project_inherit_form" model="ir.ui.view">
<field name="name">project.project.view.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<field name="has_any_so_to_invoice" invisible="1"/>
<field name="has_any_so_with_nothing_to_invoice" invisible="1"/>
<!-- remove me in master -->
<button name="action_create_invoice" string="Create Invoice" type="object" class="btn-primary" groups="sales_team.group_sale_salesman_all_leads" attrs="{'invisible': [('has_any_so_to_invoice', '=', False)]}" data-hotkey="w" invisible="1"/>
<!-- remove me in master -->
<button name="action_create_invoice" string="Create Invoice" type="object" class="btn-secondary" groups="sales_team.group_sale_salesman_all_leads" attrs="{'invisible': ['|', ('has_any_so_with_nothing_to_invoice', '=', False), ('has_any_so_to_invoice', '=', True)]}" data-hotkey="w" invisible="1"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="options">{'always_reload': True}</attribute>
<attribute name="context">{'res_partner_search_mode': 'customer'}</attribute>
</xpath>
<xpath expr="//group[@name='group_time_managment']" position="after">
<group name="group_sales_invoicing" string="Sales &amp; Invoicing" col="1" class="row mt16 o_settings_container col-lg-6">
<div>
<div class="o_setting_box" id="allow_billable_container">
<div class="o_setting_left_pane">
<field name="allow_billable"/>
</div>
<div class="o_setting_right_pane">
<label for="allow_billable"/>
<div class="text-muted" id="allow_billable_setting">
Invoice your time and material to customers
</div>
</div>
</div>
</div>
</group>
</xpath>
</field>
</record>
<record id="view_sale_project_inherit_form" model="ir.ui.view">
<field name="name">project.task.view.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<xpath expr="//span[@id='start_rating_buttons']" position="before">
<button class="oe_stat_button"
type="object" name="action_view_so" icon="fa-dollar"
attrs="{'invisible': [('sale_order_id', '=', False)]}"
string="Sales Order"
groups="sales_team.group_sale_salesman_all_leads"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="options">{'always_reload': True}</attribute>
<attribute name="context">{'res_partner_search_mode': 'customer'}</attribute>
</xpath>
<xpath expr="//field[@name='partner_phone']" position="after">
<field name="sale_order_id" attrs="{'invisible': True}" groups="sales_team.group_sale_salesman"/>
<field name="sale_line_id" groups="!sales_team.group_sale_salesman" string="Sales Order Item" options='{"no_open": True}' readonly="1"/>
<field name="sale_line_id" groups="sales_team.group_sale_salesman" string="Sales Order Item" options='{"no_create": True}' readonly="0" context="{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True}"/>
<field name="commercial_partner_id" invisible="1" />
</xpath>
</field>
</record>
<record id="project_task_view_search" model="ir.ui.view">
<field name="name">project.task.search.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_search_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="sale_order_id" string="Sale Order" filter_domain="['|', ('sale_order_id', 'ilike', self), ('sale_line_id', 'ilike', self)]"/>
</xpath>
<xpath expr="//search/group/filter[@name='customer']" position="after">
<filter string="Sales Order Item" name="sale_line_id" context="{'group_by': 'sale_line_id'}"/>
</xpath>
</field>
</record>
<record id="project_milestone_view_form" model="ir.ui.view">
<field name="name">project.milestone.view.form.inherit</field>
<field name="model">project.milestone</field>
<field name="inherit_id" ref="project.project_milestone_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='main_details']" position="after">
<field name="allow_billable" invisible="1"/>
<group attrs="{'invisible': [('allow_billable', '=', False)]}">
<field name="project_partner_id" invisible="1"/>
<field name="sale_line_id" groups="!sales_team.group_sale_salesman" placeholder="Non-billable" options="{'no_open': True}" readonly="1"/>
<field name="sale_line_id" groups="sales_team.group_sale_salesman" options="{'no_create': True}" placeholder="Non-billable" readonly="0"/>
<field name="quantity_percentage" groups="!sales_team.group_sale_salesman" widget="percentage" readonly="1"/>
<field name="quantity_percentage" class="w-25" groups="sales_team.group_sale_salesman" widget="percentage" readonly="0"/>
</group>
</xpath>
</field>
</record>
<record id="project_milestone_view_tree" model="ir.ui.view">
<field name="name">project.milestone.view.tree.inherit</field>
<field name="model">project.milestone</field>
<field name="inherit_id" ref="project.project_milestone_view_tree"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="project_partner_id" invisible="1"/>
<field name="allow_billable" invisible="1"/>
<field name="sale_line_id" optional="hide" options="{'no_open': True}" placeholder="Non-billable" readonly="1" groups="!sales_team.group_sale_salesman"/>
<field name="sale_line_id" optional="hide" options="{'no_create': True}" placeholder="Non-billable" groups="sales_team.group_sale_salesman"/>
<field name="quantity_percentage" optional="hide" widget="percentage" readonly="1" groups="!sales_team.group_sale_salesman"/>
<field name="quantity_percentage" optional="hide" widget="percentage" groups="sales_team.group_sale_salesman"/>
</xpath>
</field>
</record>
<record id="sale_project_milestone_view_tree" model="ir.ui.view">
<field name="name">project.milestone.view.tree.inherit</field>
<field name="model">project.milestone</field>
<field name="inherit_id" ref="sale_project.project_milestone_view_tree"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='sale_line_id'][1]" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
<xpath expr="//field[@name='sale_line_id'][2]" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
<xpath expr="//field[@name='quantity_percentage'][1]" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
<xpath expr="//field[@name='quantity_percentage'][2]" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="project.open_view_project_all_config" model="ir.actions.act_window">
<field name="context">{'default_allow_billable': True}</field>
</record>
<record id="project.open_view_project_all_config_group_stage" model="ir.actions.act_window">
<field name="context">{'default_allow_billable': True}</field>
</record>
<record id="project.open_view_project_all" model="ir.actions.act_window">
<field name="context">{'default_allow_billable': True}</field>
</record>
<record id="project.open_view_project_all_group_stage" model="ir.actions.act_window">
<field name="context">{'default_allow_billable': True, 'search_default_groupby_stage': 1}</field>
</record>
</odoo>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_form_inherit_sale_project" model="ir.ui.view">
<field name="name">sale.order.form.sale.project</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="priority">10</field>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_view_invoice']" position="before">
<field name="project_ids" invisible="1"/>
<field name="is_product_milestone" invisible="1"/>
<button type="object" name="action_view_project_ids" class="oe_stat_button" icon="fa-puzzle-piece" attrs="{'invisible': ['|', ('state', 'in', ['draft', 'sent']), ('project_ids', '=', [])]}" groups="project.group_project_user">
<field name="project_count" widget="statinfo" string="Projects"/>
</button>
<button class="oe_stat_button" name="action_view_milestone" type="object" icon="fa-check-square-o" attrs="{'invisible': ['|', '|', ('is_product_milestone', '=', False), ('project_ids', '=', []), ('state', '=', 'draft')]}" groups="project.group_project_milestone">
<field name="milestone_count" widget="statinfo" string="Milestones"/>
</button>
<button type="object" name="action_view_task" class="oe_stat_button" icon="fa-tasks" attrs="{'invisible': [('tasks_count', '=', 0)]}" groups="project.group_project_user">
<field name="tasks_count" widget="statinfo" string="Tasks"/>
</button>
</xpath>
<xpath expr="//field[@name='analytic_account_id']" position="after">
<field name="visible_project" invisible="1"/>
<field name="project_id" options="{'no_create': True}" attrs="{'invisible': [('visible_project', '=', False)]}"/>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_tasks_list_inherit" inherit_id="project.portal_tasks_list">
<xpath expr="//t[@t-foreach='grouped_tasks']/tbody/tr[hasclass('table-light')]" position="inside">
<th t-if="groupby == 'sale_order'" t-attf-colspan="{{grouped_tasks_colspan}}">
<span t-if="tasks[0].sudo().sale_order_id" class="text-truncate" t-field="tasks[0].sudo().sale_order_id"/>
<span t-else="">No Sales Order</span>
</th>
<th t-if="groupby == 'sale_line'" t-attf-colspan="{{grouped_tasks_colspan}}">
<span t-if="tasks[0].sudo().sale_line_id" class="text-truncate" t-field="tasks[0].sudo().sale_line_id"/>
<span t-else="">No Sales Order Item</span>
</th>
</xpath>
</template>
</odoo>