Browse Source

Added functionality to check on backend side

pull/29/head
Jos De Graeve 10 years ago
parent
commit
e459e98afe
  1. 22
      pos_require_customer/i18n/nl_NL.po
  2. 20
      pos_require_customer/i18n/pos_require_customer.pot
  3. 18
      pos_require_customer/pos.py
  4. 14
      pos_require_customer/pos_view.xml

22
pos_require_customer/i18n/nl_NL.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-02 11:36+0100\n"
"PO-Revision-Date: 2015-06-02 11:36+0100\n"
"POT-Creation-Date: 2015-06-02 15:04+0100\n"
"PO-Revision-Date: 2015-06-02 15:04+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: nl_NL\n"
@ -29,6 +29,12 @@ msgstr "Een anoniem kassa order kan niet worden bevestigd"
msgid "Customer"
msgstr "Klant"
#. module: pos_require_customer
#: code:addons/pos_require_customer/pos.py:45
#, python-format
msgid "Customer is required for this order and is missing"
msgstr "Klant is vereist voor deze order en ontbreekt"
#. module: pos_require_customer
#. openerp-web
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:17
@ -40,6 +46,11 @@ msgstr ""
"Selecteer een klant voor dit order. Dit kan gedaan worden door te klikken op "
"de tab bestelling"
#. module: pos_require_customer
#: model:ir.model,name:pos_require_customer.model_pos_order
msgid "Point of Sale"
msgstr "Kassa"
#. module: pos_require_customer
#: field:pos.config,require_customer:0
msgid "Require customer"
@ -50,5 +61,12 @@ msgstr "Klant verplichten"
msgid "Require customer for orders in this point of sale"
msgstr "Klant verplichten voor kassa orders in deze kassa."
#. module: pos_require_customer
#: view:pos.order:pos_require_customer.view_pos_pos_form_inherit
msgid ""
"{'readonly': [('state','=','invoiced')], 'required': "
"[('require_customer','=',True)]}"
msgstr ""
#~ msgid "Require customer for pos orders in the frontend"
#~ msgstr "Klant verplichten voor kassa orders in deze kassa."

20
pos_require_customer/i18n/pos_require_customer.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-02 09:24+0000\n"
"PO-Revision-Date: 2015-06-02 09:24+0000\n"
"POT-Creation-Date: 2015-06-02 13:03+0000\n"
"PO-Revision-Date: 2015-06-02 13:03+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -27,6 +27,12 @@ msgstr ""
msgid "Customer"
msgstr ""
#. module: pos_require_customer
#: code:addons/pos_require_customer/pos.py:45
#, python-format
msgid "Customer is required for this order and is missing"
msgstr ""
#. module: pos_require_customer
#. openerp-web
#: code:addons/pos_require_customer/static/src/js/pos_require_customer.js:17
@ -34,6 +40,11 @@ msgstr ""
msgid "Please select a client for this order. This can be done by clicking the order tab"
msgstr ""
#. module: pos_require_customer
#: model:ir.model,name:pos_require_customer.model_pos_order
msgid "Point of Sale"
msgstr ""
#. module: pos_require_customer
#: field:pos.config,require_customer:0
msgid "Require customer"
@ -44,3 +55,8 @@ msgstr ""
msgid "Require customer for orders in this point of sale"
msgstr ""
#. module: pos_require_customer
#: view:pos.order:pos_require_customer.view_pos_pos_form_inherit
msgid "{'readonly': [('state','=','invoiced')], 'required': [('require_customer','=',True)]}"
msgstr ""

18
pos_require_customer/pos.py

@ -18,7 +18,8 @@
#
##############################################################################
from openerp import fields, models
from openerp import fields, models, exceptions, api
from openerp.tools.translate import _
class PosConfig(models.Model):
@ -27,3 +28,18 @@ class PosConfig(models.Model):
require_customer = fields.Boolean(
string='Require customer',
help='Require customer for orders in this point of sale')
class PosOrder(models.Model):
_inherit = 'pos.order'
require_customer = fields.Boolean(
string='Require customer',
related='session_id.config_id.require_customer', readonly=True)
@api.one
@api.constrains('partner_id', 'require_customer')
def _check_partner(self):
if self.require_customer and not self.partner_id:
raise exceptions.ValidationError(
_('Customer is required for this order and is missing'))

14
pos_require_customer/pos_view.xml

@ -16,5 +16,19 @@
</field>
</record>
<record model="ir.ui.view" id="view_pos_pos_form_inherit">
<field name="name">pos.order</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<field name="require_customer" invisible="1"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="attrs">{'readonly': [('state','=','invoiced')], 'required': [('require_customer','=',True)]}</attribute>
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save