Skip to content

Commit

Permalink
[ADD] sale_order_partner_invoice_period: added groups restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
DantePereyra committed Nov 22, 2024
1 parent aeaaa57 commit c547fb6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
10 changes: 8 additions & 2 deletions sale_order_partner_invoice_period/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-20 14:49+0000\n"
"PO-Revision-Date: 2024-11-20 14:49+0000\n"
"POT-Creation-Date: 2024-11-22 10:06+0000\n"
"PO-Revision-Date: 2024-11-22 10:06+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -22,11 +22,13 @@ msgstr "Contacto"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__daily
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__daily
msgid "Daily"
msgstr "Diario"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__fortnightly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__fortnightly
msgid "Fortnightly"
msgstr "Quincenal"

Expand All @@ -39,11 +41,13 @@ msgstr "Periodo de facturación"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__monthly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__monthly
msgid "Monthly"
msgstr "Mensual"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__quarterly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__quarterly
msgid "Quarterly"
msgstr "Trimestral"

Expand All @@ -54,10 +58,12 @@ msgstr "Pedido de venta"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__weekly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__weekly
msgid "Weekly"
msgstr "Semanal"

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__yearly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__yearly
msgid "Yearly"
msgstr "Anual"
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-20 14:48+0000\n"
"PO-Revision-Date: 2024-11-20 14:48+0000\n"
"POT-Creation-Date: 2024-11-22 10:06+0000\n"
"PO-Revision-Date: 2024-11-22 10:06+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -22,11 +22,13 @@ msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__daily
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__daily
msgid "Daily"
msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__fortnightly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__fortnightly
msgid "Fortnightly"
msgstr ""

Expand All @@ -39,11 +41,13 @@ msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__monthly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__monthly
msgid "Monthly"
msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__quarterly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__quarterly
msgid "Quarterly"
msgstr ""

Expand All @@ -54,10 +58,12 @@ msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__weekly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__weekly
msgid "Weekly"
msgstr ""

#. module: sale_order_partner_invoice_period
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__yearly
#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__yearly
msgid "Yearly"
msgstr ""
22 changes: 11 additions & 11 deletions sale_order_partner_invoice_period/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
from odoo import models, fields

INVOICE_PERIOD_SELECTION = [
('daily','Daily'),
('weekly','Weekly'),
('fortnightly','Fortnightly'),
('monthly','Monthly'),
('quarterly','Quarterly'),
('yearly','Yearly')
]


class ResPartner(models.Model):
_inherit = "res.partner"


invoice_period = fields.Selection(
[
('daily','Daily'),
('weekly','Weekly'),
('fortnightly','Fortnightly'),
('monthly','Monthly'),
('quarterly','Quarterly'),
('yearly','Yearly')
]
)
invoice_period = fields.Selection(INVOICE_PERIOD_SELECTION)
10 changes: 2 additions & 8 deletions sale_order_partner_invoice_period/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
from odoo import models, fields, api
from .res_partner import INVOICE_PERIOD_SELECTION

class SaleOrder(models.Model):
_inherit = "sale.order"

partner_invoice_period = fields.Selection(
selection=[
('daily', 'Daily'),
('weekly', 'Weekly'),
('fortnightly', 'Fortnightly'),
('monthly', 'Monthly'),
('quarterly', 'Quarterly'),
('yearly', 'Yearly'),
],
selection=INVOICE_PERIOD_SELECTION,
compute='_compute_partner_invoice_period',
string="Invoice Period",
store=True
Expand Down
3 changes: 2 additions & 1 deletion sale_order_partner_invoice_period/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_payment_term_id']" position="after">
<field name="invoice_period"/>
<field name="invoice_period" groups="account.group_account_invoice, sales_team.group_sale_salesman">
</field>
</xpath>
</field>
</record>
Expand Down
5 changes: 4 additions & 1 deletion sale_order_partner_invoice_period/views/sale_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<xpath expr="//search//filter[@name='order_month']" position="after">
<xpath expr="//field[@name='analytic_account_id']" position="after">
<field name="partner_invoice_period"/>
</xpath>
<xpath expr="//filter[@name='order_month']" position="after">
<filter name="partner_invoice_period" context="{'group_by': 'partner_invoice_period'}"/>
</xpath>

</field>
</record>
Expand Down

0 comments on commit c547fb6

Please sign in to comment.