Skip to content

Commit

Permalink
[MIG] sale_ux: Migration to 17.0
Browse files Browse the repository at this point in the history
closes #743

Signed-off-by: jok-adhoc <jok@adhoc.com.ar>
  • Loading branch information
matiasperalta1 committed Dec 15, 2023
1 parent 96d64c8 commit 4c66030
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 158 deletions.
13 changes: 6 additions & 7 deletions sale_ux/README.rst
Expand Up @@ -19,25 +19,24 @@ Several Improvements to sales:
#. Make sale quotations menu not visible.
#. Hide sale invoicing menu (you can already filter on sales orders menu)
#. Add filters in the sale order view
#. Make sale orders menu show all sale records (quotations, and confirmed ones).
#. Make that, by default, links to sale orders shows "sale" data and not only "quotation" data.
#. Make sale orders menu show all sale records (quotations, and confirmed ones). Make that, by default, links to sale orders shows "sale" data and not only "quotation" data.
#. Add option in settings to show "Customer Reference" field on Sale Order tree view and in the main section of the form view.
#. Add a menu item on Orders for "Sale Order Lines" and improve views with more fields.
#. Make button "Send by email" also available on sale orders with "locked" state.
#. Make the "Cancel" button also visible sale orders with done state so that if "Lock confirmed Orders" setting is enabled, sale users can still cancel a sale order that has not been delivered or invoiced yet without having to unlock it.
#. Allow cancel sales orders in locked state and unlock it after cancelling
#. Fix in button "Create invoice" in sale orders, to create a refund invoice if the sale order amount it's zero and the line's quantities are negative (because of a return).
#. Block cancellation of a sale order if there is a related invoice in a state different from "draft" or "cancel".
#. Customer Preview" button in sale orders, opens the online quotation in a new tab.
#. Add a wizard on sales orders that allow you to define global discounts to sale orders by percentage.
#. Makes included/excluded taxes optional on total OV/invoice lines and not related to b2b/b2c taxes.
#. We rename the field price_subtotal and price_total to "Subtotal" and "Total" respectively in sale.order.form
#. Add option in Sales settings to update prices automatically.
#. Add selection field to force "Invoiced" status of a sale order, available only for admin with tec features.
#. Add options in settings to allow any user as salesman (portal or internal)
#. Add filter to be able to select an analytic account on sale orders with the same partner/commercial partner as the sale order.
#. Add tracking to payment terms on sale orders.
#. Add the field "Internal Notes" in the sales order form and the setting to allow propagating the "Internal Notes" to invoices.
#. Add the field "Internal Notes" in the sales order form and the setting to allow propagating the "Internal Notes / terms & conditions" to invoices / pickings.
#. Automatically refresh taxes when changing fiscal position
#. Do not use fiscal positions on prices. By default, when using fiscal position and taxes included on the price on sale orders, the price used on the sale line will be the price without the tax being replaced. We remove that functionality. There are some issues where this is already discussed in odoo standard. For eg. https://github.com/odoo/odoo/issues/66875
#. Makes the "update prices" button visible.
#. Show product image on report


Installation
Expand Down
4 changes: 2 additions & 2 deletions sale_ux/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Sale UX',
'version': "16.0.1.9.0",
'version': "17.0.1.0.0",
'category': 'Sales',
'sequence': 14,
'summary': '',
Expand Down Expand Up @@ -48,7 +48,7 @@
],
'demo': [
],
'installable': False,
'installable': True,
'auto_install': False,
'application': False,
}
5 changes: 0 additions & 5 deletions sale_ux/i18n/de.po
Expand Up @@ -113,11 +113,6 @@ msgstr "Vollständig abgerechnet"
msgid "Global Discount"
msgstr "Globaler Rabatt"

#. module: sale_ux
#: model:ir.actions.act_window,name:sale_ux.action_sale_global_discount_wizard_form
msgid "Global Discount Wizard"
msgstr "Assistent für globalen Rabatt"

#. module: sale_ux
#: model_terms:ir.ui.view,arch_db:sale_ux.view_sales_order_line_filter
msgid "Hide cancelled lines"
Expand Down
5 changes: 0 additions & 5 deletions sale_ux/i18n/es.po
Expand Up @@ -155,11 +155,6 @@ msgstr "Completamente facturado"
msgid "Global Discount"
msgstr "Descuento Global"

#. module: sale_ux
#: model:ir.actions.act_window,name:sale_ux.action_sale_global_discount_wizard_form
msgid "Global Discount Wizard"
msgstr "Asistente para Descuento Global"

#. module: sale_ux
#: model:ir.model.fields,field_description:sale_ux.field_account_bank_statement_line__has_sales
#: model:ir.model.fields,field_description:sale_ux.field_account_move__has_sales
Expand Down
5 changes: 0 additions & 5 deletions sale_ux/i18n/fr.po
Expand Up @@ -113,11 +113,6 @@ msgstr ""
msgid "Global Discount"
msgstr ""

#. module: sale_ux
#: model:ir.actions.act_window,name:sale_ux.action_sale_global_discount_wizard_form
msgid "Global Discount Wizard"
msgstr ""

#. module: sale_ux
#: model_terms:ir.ui.view,arch_db:sale_ux.view_sales_order_line_filter
msgid "Hide cancelled lines"
Expand Down
5 changes: 0 additions & 5 deletions sale_ux/i18n/ru.po
Expand Up @@ -113,11 +113,6 @@ msgstr ""
msgid "Global Discount"
msgstr ""

#. module: sale_ux
#: model:ir.actions.act_window,name:sale_ux.action_sale_global_discount_wizard_form
msgid "Global Discount Wizard"
msgstr ""

#. module: sale_ux
#: model_terms:ir.ui.view,arch_db:sale_ux.view_sales_order_line_filter
msgid "Hide cancelled lines"
Expand Down
39 changes: 34 additions & 5 deletions sale_ux/models/sale_order.py
Expand Up @@ -92,7 +92,39 @@ def action_cancel(self):
raise UserError(_(
"Unable to cancel this sale order. You must first "
"cancel related bills and pickings."))
return super().action_cancel()
if any(order.locked for order in self):
#No encontre otra forma de evitar el raise usererror que impide que ordenes se cancelen si el pedido está bloqueado
cancel_warning = self._show_cancel_wizard()
if cancel_warning:
self.ensure_one()
template_id = self.env['ir.model.data']._xmlid_to_res_id(
'sale.mail_template_sale_cancellation', raise_if_not_found=False
)
lang = self.env.context.get('lang')
template = self.env['mail.template'].browse(template_id)
if template.lang:
lang = template._render_lang(self.ids)[self.id]
ctx = {
'default_template_id': template_id,
'default_order_id': self.id,
'mark_so_as_canceled': True,
'default_email_layout_xmlid': "mail.mail_notification_layout_with_responsible_signature",
'model_description': self.with_context(lang=lang).type_name,
}
self.action_unlock()
return {
'name': _('Cancel %s', self.type_name),
'view_mode': 'form',
'res_model': 'sale.order.cancel',
'view_id': self.env.ref('sale.sale_order_cancel_view_form').id,
'type': 'ir.actions.act_window',
'context': ctx,
'target': 'new'
}
else:
return self._action_cancel()
else:
return super().action_cancel()

@api.constrains('force_invoiced_status')
def check_force_invoiced_status(self):
Expand Down Expand Up @@ -176,7 +208,7 @@ def _create_invoices(self, grouped=False, final=False, date=None):
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
invoices.filtered(
lambda i: float_is_zero(i.amount_total, precision_digits=precision) and all(
[line.quantity <= 0.0 for line in i.invoice_line_ids])).action_switch_invoice_into_refund_credit_note()
[line.quantity <= 0.0 for line in i.invoice_line_ids])).action_switch_move_type()
return invoices

def action_preview_sale_order(self):
Expand All @@ -202,17 +234,14 @@ def _prepare_analytic_account_data(self, prefix=None):
if prefix:
name = prefix + ": " + self.name
plan = self.env['account.analytic.plan'].sudo().search([
('company_id', '=', False)
], limit=1)
if not plan:
plan = self.env['account.analytic.plan'].sudo().create({
'name': 'Default',
'company_id': False,
})
return {
'name': name,
'code': self.client_order_ref,
'company_id': False,
'plan_id': plan.id,
'partner_id': self.partner_id.id,
}
Expand Down
138 changes: 46 additions & 92 deletions sale_ux/views/res_config_settings_views.xml
@@ -1,118 +1,72 @@
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='analytic']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="analytic_account_without_company"/>
</div>
<div class="o_setting_right_pane">
<label for="analytic_account_without_company"/>
<div class="text-muted">
Al confirmar ventas, crear cuenta analitica sin compañía
</div>
</div>
</div>
</xpath>
</field>
</record>

<record id="res_config_settings_view_form_inherit" model="ir.ui.view">
<field name="name">res.config.settings.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='sale_management']/div" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="show_product_image_on_report"/>

<xpath expr="//div[@id='order_default_values_div']" position="after">
<div class="mt16">
<div>
<field name="group_allow_any_user_as_salesman"/>
<label for="group_allow_any_user_as_salesman"/>
</div>
<div class="o_setting_right_pane">
<label for="show_product_image_on_report" string="Show Product Image On Report"/>
<div class="text-muted">
Show Product Image On Report
</div>
<div class="text-muted">
By default, Odoo only allows to choose users who have sales permission in sales orders and only internal users in the sales' teams . This option enables to choose, in both places, users of any type (internal or portal)
</div>
</div>
</xpath>
<xpath expr="//div[@data-key='sale_management']/div[3]">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="dont_send_notes_to_invoices"/>
<div class="mt16">
<div >
<field name="group_sale_reference_on_tree_and_main_form"/>
<label for="group_sale_reference_on_tree_and_main_form"/>
</div>
<div class="o_setting_right_pane">
<label for="dont_send_notes_to_invoices" string="Do not send notes to invoices"/>
<div class="text-muted">
Do not take the notes from the sale order line to the invoice line when create an invoice from a sale order.
</div>
<div class="text-muted">
Show client reference in list view and in main section of form view
</div>
</div>
</xpath>

<xpath expr="//div[@id='sale_config_online_confirmation_sign']" position="after">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_allow_any_user_as_salesman"/>
<div class="mt16">
<div>
<field name="update_prices_automatically"/>
<label for="update_prices_automatically"/>
</div>
<div class="o_setting_right_pane">
<label for="group_allow_any_user_as_salesman"/>
<div class="text-muted">
By default odoo only allows to choose users wich have sales pemission in sales orders and in the sales teams only internal users. This option make able to choose, in both places, users of any type (internal or portal)
</div>
<div class="text-muted">
Automatically update prices when change pricelist.
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_sale_reference_on_tree_and_main_form"/>
<div class="mt16">
<div>
<field name="move_internal_notes"/>
<label for="move_internal_notes"/>
</div>
<div class="o_setting_right_pane">
<label for="group_sale_reference_on_tree_and_main_form"/>
<div class="text-muted">
Show client reference in list view and in main section of form view
</div>
<div class="text-muted">
Si marca esta opción y hay un valor definido en las "notas internas", el mismo se va a copiar en las facturas o transferencias que se generen desde esta venta.
</div>
</div>
</xpath>

<xpath expr="//div[@data-key='sale_management']/div[3]" position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="update_prices_automatically"/>
</div>
<div class="o_setting_right_pane">
<label for="update_prices_automatically"/>
<div class="text-muted">
Automatically update prices when change pricelist.
</div>
<div class="content-group" id="msg_update_prices_automatically"/>
</div>
<div class="mt16">
<div>
<field name="move_note"/>
<label for="move_note"/>
</div>
</xpath>

<xpath expr="//div[@data-key='sale_management']/div[3]">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="move_internal_notes"/>
<div class="text-muted">
Si marca esta opción y hay un valor definido en "términos y condiciones", el mismo se va a copiar en las facturas o transferencias que se generen desde esta venta.
</div>
<div class="o_setting_right_pane">
<label for="move_internal_notes"/>
<div class="text-muted">
Si marca esta opción y hay un valor definido en las "notas internas", el mismo se va a copiar en las facturas o transferencias que se generen desde esta venta.
</div>
</div>
<div class="mt16">
<div>
<field name="show_product_image_on_report"/>
<label for="show_product_image_on_report"/>
</div>
<div class="text-muted">
Show Product Image On Report
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="move_note"/>
<div class="mt16">
<div>
<field name="analytic_account_without_company"/>
<label for="analytic_account_without_company"/>
</div>
<div class="o_setting_right_pane">
<label for="move_note"/>
<div class="text-muted">
Si marca esta opción y hay un valor definido en "términos y condiciones", el mismo se va a copiar en las facturas o transferencias que se generen desde esta venta.
</div>
<div class="text-muted">
Al confirmar ventas, crear cuenta analitica sin compañía.
</div>
</div>
</xpath>
Expand Down
4 changes: 2 additions & 2 deletions sale_ux/views/sale_order_line_views.xml
Expand Up @@ -7,7 +7,7 @@
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<tree>
<field name="currency_id" invisible="1"/>
<field name="currency_id" column_invisible="True"/>
</tree>
</field>
</record>
Expand Down Expand Up @@ -53,7 +53,7 @@
<field name="untaxed_amount_invoiced" optional="hide"/>
<field name="untaxed_amount_to_invoice" optional="hide"/>
<field name="price_subtotal" sum="Total" widget="monetary"/>
<field name="currency_id" invisible="1"/>
<field name="currency_id" column_invisible="True"/>
</tree>
</field>
</record>
Expand Down

0 comments on commit 4c66030

Please sign in to comment.