Browse Source

[FIX] fix ported from v9

pull/7/head
houssine 6 years ago
parent
commit
e826566d49
  1. 8
      easy_my_coop/controllers/main.py
  2. 11
      easy_my_coop/models/coop.py
  3. 158
      easy_my_coop/view/account_invoice_view.xml
  4. 5
      easy_my_coop_ch/models/coop.py

8
easy_my_coop/controllers/main.py

@ -248,7 +248,7 @@ class WebsiteSubscription(http.Controller):
"is not valid")
return request.website.render(redirect, values)
if not is_company:
if not is_company and 'no_registre' in required_fields:
no_registre = re.sub('[^0-9a-zA-Z]+', '',
kwargs.get("no_registre"))
valid = sub_req_obj.check_belgian_identification_id(no_registre)
@ -304,6 +304,8 @@ class WebsiteSubscription(http.Controller):
def share_subscription(self, **kwargs):
sub_req_obj = request.env['subscription.request']
attach_obj = request.env['ir.attachment']
required_fields = sub_req_obj.sudo().get_required_field()
# List of file to add to ir_attachment once we have the ID
post_file = []
# Info to add after the message
@ -360,6 +362,10 @@ class WebsiteSubscription(http.Controller):
no_registre = re.sub('[^0-9a-zA-Z]+', '',
kwargs.get("no_registre"))
values["no_registre"] = no_registre
if 'no_registre' in required_fields:
no_registre = re.sub('[^0-9a-zA-Z]+', '',
kwargs.get("no_registre"))
values["no_registre"] = no_registre
subscription_id = sub_req_obj.sudo().create(values)

11
easy_my_coop/models/coop.py

@ -253,8 +253,11 @@ class subscription_request(models.Model):
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d'))
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: datetime.strftime(datetime.now(),
'%Y-%m-%d'))
company_id = fields.Many2one('res.company',
string='Company',
required=True,
change_default=True,
readonly=True,
default=lambda self: self.env['res.company']._company_default_get())
@ -485,6 +488,7 @@ class subscription_request(models.Model):
partner = self.partner_id
else:
partner = None
domain = []
if self.already_cooperator:
raise UserError(_('The checkbox already cooperator is'
' checked please select a cooperator.'))
@ -493,7 +497,8 @@ class subscription_request(models.Model):
elif not self.is_company and self.no_registre:
domain = [('national_register_number', '=', self.no_registre)]
partner = partner_obj.search(domain)
if domain:
partner = partner_obj.search(domain)
if not partner:
partner = self.create_coop_partner()

158
easy_my_coop/view/account_invoice_view.xml

@ -1,88 +1,86 @@
<openerp>
<data>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<field name="move_id" position="after">
<field name="subscription_request"/>
</field>
</field>
</record>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<field name="move_id" position="after">
<field name="subscription_request"/>
</field>
</field>
</record>
<record id="action_invoice_tree_coop" model="ir.actions.act_window">
<field name="name">Cooperator Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',True)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a cooperator invoice.
</p><p>
OpenERP's electronic invoicing allows to ease and fasten the
collection of cooperator payments. The cooperator customer receives the
invoice by email and he can pay online and/or import it
in his own system.
</p><p>
The discussions with the cooperator are automatically displayed at
the bottom of each invoice.
</p>
</field>
</record>
<record id="action_invoice_tree_coop" model="ir.actions.act_window">
<field name="name">Cooperator Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',True)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a cooperator invoice.
</p><p>
OpenERP's electronic invoicing allows to ease and fasten the
collection of cooperator payments. The cooperator customer receives the
invoice by email and he can pay online and/or import it
in his own system.
</p><p>
The discussions with the cooperator are automatically displayed at
the bottom of each invoice.
</p>
</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="action_invoice_tree1_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_form"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="action_invoice_tree1_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_form"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<menuitem action="action_invoice_tree_coop" id="menu_action_invoice_tree_coop" parent="menu_easy_my_coop_main_coop" groups="easy_my_coop.group_energiris_user"/>
<menuitem action="action_invoice_tree_coop" id="menu_action_invoice_tree_coop" parent="menu_easy_my_coop_main_coop" groups="easy_my_coop.group_energiris_user"/>
<record id="account.action_invoice_tree1" model="ir.actions.act_window">
<field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a customer invoice.
</p><p>
Odoo's electronic invoicing allows to ease and fasten the
collection of customer payments. Your customer receives the
invoice by email and he can pay online and/or import it
in his own system.
</p><p>
The discussions with your customer are automatically displayed at
the bottom of each invoice.
</p>
</field>
</record>
<record id="account.action_invoice_tree1" model="ir.actions.act_window">
<field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a customer invoice.
</p><p>
Odoo's electronic invoicing allows to ease and fasten the
collection of customer payments. Your customer receives the
invoice by email and he can pay online and/or import it
in his own system.
</p><p>
The discussions with your customer are automatically displayed at
the bottom of each invoice.
</p>
</field>
</record>
<record id="account.action_invoice_refund_out_tree" model="ir.actions.act_window">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="domain">[('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel']),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record>
</data>
<record id="account.action_invoice_refund_out_tree" model="ir.actions.act_window">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="domain">[('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel']),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record>
</openerp>

5
easy_my_coop_ch/models/coop.py

@ -24,3 +24,8 @@ class subscription_request(models.Model):
def check_belgian_identification_id(self, nat_register_num):
# deactivate number validation for swiss localization
return True
def check_iban(self, iban):
if iban:
return super(subscription_request, self).check_iban(iban)
return True
Loading…
Cancel
Save